.class public Lorg/microemu/app/Common;
.super Ljava/lang/Object;
.source "Common.java"

# interfaces
.implements Lorg/microemu/MicroEmulator;
.implements Lorg/microemu/app/CommonInterface;


# static fields
.field static class$java$io$Serializable:Ljava/lang/Class;

.field static class$org$microemu$Injected:Ljava/lang/Class;

.field static class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

.field static class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

.field static class$org$microemu$microedition$ImplementationInitialization:Ljava/lang/Class;

.field private static instance:Lorg/microemu/app/Common;

.field private static launcher:Lorg/microemu/app/launcher/Launcher;

.field private static statusBarListener:Lorg/microemu/app/ui/StatusBarListener;


# instance fields
.field private autoTests:Z

.field private destroyNotify:Ljava/lang/Object;

.field protected emulatorContext:Lorg/microemu/EmulatorContext;

.field private exitOnMIDletDestroy:Z

.field private extensions:Ljava/util/Vector;

.field private extensionsClassLoader:Lorg/microemu/app/classloader/ExtensionsClassLoader;

.field protected jad:Lorg/microemu/util/JadProperties;

.field private jadURL:Ljava/lang/String;

.field private mIDletClassLoaderConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

.field private manifest:Lorg/microemu/util/JadProperties;

.field private midletClassOrUrl:Ljava/lang/String;

.field private propertiesJad:Ljava/lang/String;

.field private recordStoreManager:Lorg/microemu/RecordStoreManager;

.field private responseInterfaceListener:Lorg/microemu/app/ui/ResponseInterfaceListener;

.field private useSystemClassLoader:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 100
    const/4 v0, 0x0

    sput-object v0, Lorg/microemu/app/Common;->statusBarListener:Lorg/microemu/app/ui/StatusBarListener;

    return-void
.end method

.method public constructor <init>(Lorg/microemu/EmulatorContext;)V
    .locals 3
    .parameter "context"

    .prologue
    const/4 v2, 0x0

    const/4 v1, 0x0

    .line 128
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 94
    new-instance v0, Lorg/microemu/util/JadProperties;

    invoke-direct {v0}, Lorg/microemu/util/JadProperties;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    .line 102
    new-instance v0, Lorg/microemu/util/JadProperties;

    invoke-direct {v0}, Lorg/microemu/util/JadProperties;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    .line 106
    iput-object v1, p0, Lorg/microemu/app/Common;->responseInterfaceListener:Lorg/microemu/app/ui/ResponseInterfaceListener;

    .line 110
    new-instance v0, Ljava/util/Vector;

    invoke-direct {v0}, Ljava/util/Vector;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/Common;->extensions:Ljava/util/Vector;

    .line 114
    iput-boolean v2, p0, Lorg/microemu/app/Common;->useSystemClassLoader:Z

    .line 116
    iput-boolean v2, p0, Lorg/microemu/app/Common;->autoTests:Z

    .line 118
    iput-object v1, p0, Lorg/microemu/app/Common;->propertiesJad:Ljava/lang/String;

    .line 120
    iput-object v1, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    .line 122
    iput-object v1, p0, Lorg/microemu/app/Common;->jadURL:Ljava/lang/String;

    .line 124
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/Common;->destroyNotify:Ljava/lang/Object;

    .line 126
    iput-boolean v2, p0, Lorg/microemu/app/Common;->exitOnMIDletDestroy:Z

    .line 129
    sput-object p0, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    .line 130
    iput-object p1, p0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    .line 135
    invoke-static {}, Lorg/microemu/microedition/ImplFactory;->instance()Lorg/microemu/microedition/ImplFactory;

    .line 136
    invoke-static {}, Lorg/microemu/app/util/MIDletSystemProperties;->initContext()V

    .line 138
    const-string v0, "org.microemu.default"

    new-instance v1, Lorg/microemu/microedition/io/ConnectorImpl;

    invoke-direct {v1}, Lorg/microemu/microedition/io/ConnectorImpl;-><init>()V

    invoke-static {v0, v1}, Lorg/microemu/microedition/ImplFactory;->registerGCF(Ljava/lang/String;Ljava/lang/Object;)V

    .line 140
    invoke-static {p0}, Lorg/microemu/MIDletBridge;->setMicroEmulator(Lorg/microemu/MicroEmulator;)V

    .line 141
    return-void
.end method

.method static access$000(Ljava/lang/String;)Lorg/microemu/util/JadProperties;
    .locals 1
    .parameter "x0"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 90
    invoke-static {p0}, Lorg/microemu/app/Common;->loadJadProperties(Ljava/lang/String;)Lorg/microemu/util/JadProperties;

    move-result-object v0

    return-object v0
.end method

.method static access$100(Lorg/microemu/app/Common;Z)Lorg/microemu/app/classloader/MIDletClassLoader;
    .locals 1
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 90
    invoke-direct {p0, p1}, Lorg/microemu/app/Common;->createMIDletClassLoader(Z)Lorg/microemu/app/classloader/MIDletClassLoader;

    move-result-object v0

    return-object v0
.end method

.method static access$200(Lorg/microemu/app/Common;Ljava/lang/Class;Lorg/microemu/MIDletAccess;)Lorg/microemu/MIDletContext;
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"

    .prologue
    .line 90
    invoke-direct {p0, p1, p2}, Lorg/microemu/app/Common;->startMidlet(Ljava/lang/Class;Lorg/microemu/MIDletAccess;)Lorg/microemu/MIDletContext;

    move-result-object v0

    return-object v0
.end method

.method static access$300(Lorg/microemu/app/Common;)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 90
    iget-object v0, p0, Lorg/microemu/app/Common;->destroyNotify:Ljava/lang/Object;

    return-object v0
.end method

.method static class$(Ljava/lang/String;)Ljava/lang/Class;
    .locals 2
    .parameter "x0"

    .prologue
    .line 663
    :try_start_0
    invoke-static {p0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    return-object v1

    :catch_0
    move-exception v0

    .local v0, x1:Ljava/lang/ClassNotFoundException;
    new-instance v1, Ljava/lang/NoClassDefFoundError;

    invoke-direct {v1}, Ljava/lang/NoClassDefFoundError;-><init>()V

    invoke-virtual {v1, v0}, Ljava/lang/NoClassDefFoundError;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v1

    throw v1
.end method

.method public static createExtensionsClassLoader([Ljava/net/URL;)Ljava/lang/ClassLoader;
    .locals 2
    .parameter "urls"

    .prologue
    .line 944
    new-instance v0, Lorg/microemu/app/classloader/ExtensionsClassLoader;

    invoke-static {}, Lorg/microemu/app/Common;->getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;

    move-result-object v1

    invoke-direct {v0, p0, v1}, Lorg/microemu/app/classloader/ExtensionsClassLoader;-><init>([Ljava/net/URL;Ljava/lang/ClassLoader;)V

    return-object v0
.end method

.method private createMIDletClassLoader(Z)Lorg/microemu/app/classloader/MIDletClassLoader;
    .locals 6
    .parameter "forJad"

    .prologue
    const-string v5, "org.microemu.Injected"

    .line 924
    new-instance v1, Lorg/microemu/app/classloader/MIDletClassLoader;

    invoke-static {}, Lorg/microemu/app/Common;->getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;

    move-result-object v2

    invoke-direct {v1, v2}, Lorg/microemu/app/classloader/MIDletClassLoader;-><init>(Ljava/lang/ClassLoader;)V

    .line 925
    .local v1, mcl:Lorg/microemu/app/classloader/MIDletClassLoader;
    sget-object v2, Lorg/microemu/app/Common;->class$java$io$Serializable:Ljava/lang/Class;

    if-nez v2, :cond_2

    const-string v2, "java.io.Serializable"

    invoke-static {v2}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v2

    sput-object v2, Lorg/microemu/app/Common;->class$java$io$Serializable:Ljava/lang/Class;

    :goto_0
    sget-object v3, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    if-nez v3, :cond_3

    const-string v3, "org.microemu.Injected"

    invoke-static {v5}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v3

    sput-object v3, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    :goto_1
    invoke-virtual {v2, v3}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z

    move-result v2

    if-nez v2, :cond_0

    .line 926
    const-string v2, "classpath configuration error, Wrong Injected class detected. microemu-injected module should be after microemu-javase in eclipse"

    invoke-static {v2}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;)V

    .line 929
    :cond_0
    iget-object v2, p0, Lorg/microemu/app/Common;->mIDletClassLoaderConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

    if-eqz v2, :cond_1

    .line 931
    :try_start_0
    iget-object v2, p0, Lorg/microemu/app/Common;->mIDletClassLoaderConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

    invoke-virtual {v1, v2, p1}, Lorg/microemu/app/classloader/MIDletClassLoader;->configure(Lorg/microemu/app/classloader/MIDletClassLoaderConfig;Z)V
    :try_end_0
    .catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0

    .line 936
    :cond_1
    :goto_2
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    if-nez v2, :cond_4

    const-string v2, "org.microemu.Injected"

    invoke-static {v5}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v2

    sput-object v2, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    :goto_3
    invoke-virtual {v1, v2}, Lorg/microemu/app/classloader/MIDletClassLoader;->disableClassPreporcessing(Ljava/lang/Class;)V

    .line 937
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    if-nez v2, :cond_5

    const-string v2, "org.microemu.app.util.MIDletThread"

    invoke-static {v2}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v2

    sput-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    :goto_4
    invoke-virtual {v1, v2}, Lorg/microemu/app/classloader/MIDletClassLoader;->disableClassPreporcessing(Ljava/lang/Class;)V

    .line 938
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    if-nez v2, :cond_6

    const-string v2, "org.microemu.app.util.MIDletTimer"

    invoke-static {v2}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v2

    sput-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    :goto_5
    invoke-virtual {v1, v2}, Lorg/microemu/app/classloader/MIDletClassLoader;->disableClassPreporcessing(Ljava/lang/Class;)V

    .line 939
    sput-object v1, Lorg/microemu/app/util/MIDletResourceLoader;->classLoader:Ljava/lang/ClassLoader;

    .line 940
    return-object v1

    .line 925
    :cond_2
    sget-object v2, Lorg/microemu/app/Common;->class$java$io$Serializable:Ljava/lang/Class;

    goto :goto_0

    :cond_3
    sget-object v3, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    goto :goto_1

    .line 932
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 933
    .local v0, e:Ljava/net/MalformedURLException;
    const-string v2, "Error"

    new-instance v3, Ljava/lang/StringBuffer;

    invoke-direct {v3}, Ljava/lang/StringBuffer;-><init>()V

    const-string v4, "Unable to find MIDlet classes, "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-static {v0}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3, v0}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2

    .line 936
    .end local v0           #e:Ljava/net/MalformedURLException;
    :cond_4
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$Injected:Ljava/lang/Class;

    goto :goto_3

    .line 937
    :cond_5
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletThread:Ljava/lang/Class;

    goto :goto_4

    .line 938
    :cond_6
    sget-object v2, Lorg/microemu/app/Common;->class$org$microemu$app$util$MIDletTimer:Ljava/lang/Class;

    goto :goto_5
.end method

.method public static dispose()V
    .locals 3

    .prologue
    .line 199
    :try_start_0
    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v1

    .line 200
    .local v1, midletAccess:Lorg/microemu/MIDletAccess;
    if-eqz v1, :cond_0

    .line 201
    const/4 v2, 0x1

    invoke-virtual {v1, v2}, Lorg/microemu/MIDletAccess;->destroyApp(Z)V
    :try_end_0
    .catch Ljavax/microedition/midlet/MIDletStateChangeException; {:try_start_0 .. :try_end_0} :catch_0

    .line 207
    .end local v1           #midletAccess:Lorg/microemu/MIDletAccess;
    :cond_0
    :goto_0
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v2

    invoke-interface {v2}, Lorg/microemu/device/Device;->getInputMethod()Lorg/microemu/device/InputMethod;

    move-result-object v2

    invoke-virtual {v2}, Lorg/microemu/device/InputMethod;->dispose()V

    .line 208
    return-void

    .line 203
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 204
    .local v0, ex:Ljavax/microedition/midlet/MIDletStateChangeException;
    invoke-static {v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method private static getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;
    .locals 4

    .prologue
    .line 916
    sget-object v0, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    iget-object v0, v0, Lorg/microemu/app/Common;->extensionsClassLoader:Lorg/microemu/app/classloader/ExtensionsClassLoader;

    if-nez v0, :cond_0

    .line 917
    sget-object v0, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    new-instance v1, Lorg/microemu/app/classloader/ExtensionsClassLoader;

    const/4 v2, 0x0

    new-array v2, v2, [Ljava/net/URL;

    sget-object v3, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    invoke-virtual {v3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;

    move-result-object v3

    invoke-direct {v1, v2, v3}, Lorg/microemu/app/classloader/ExtensionsClassLoader;-><init>([Ljava/net/URL;Ljava/lang/ClassLoader;)V

    iput-object v1, v0, Lorg/microemu/app/Common;->extensionsClassLoader:Lorg/microemu/app/classloader/ExtensionsClassLoader;

    .line 920
    :cond_0
    sget-object v0, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    iget-object v0, v0, Lorg/microemu/app/Common;->extensionsClassLoader:Lorg/microemu/app/classloader/ExtensionsClassLoader;

    return-object v0
.end method

.method private static getInstance()Lorg/microemu/app/Common;
    .locals 1

    .prologue
    .line 644
    sget-object v0, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    return-object v0
.end method

.method public static isMIDletUrlExtension(Ljava/lang/String;)Z
    .locals 5
    .parameter "nameString"

    .prologue
    const/4 v3, -0x1

    const/4 v4, 0x0

    .line 211
    if-nez p0, :cond_0

    move v2, v4

    .line 226
    :goto_0
    return v2

    .line 215
    :cond_0
    const-string v2, "http://"

    invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v2

    if-nez v2, :cond_1

    const-string v2, "https://"

    invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 216
    :cond_1
    const/16 v2, 0x3f

    invoke-virtual {p0, v2}, Ljava/lang/String;->lastIndexOf(I)I

    move-result v1

    .line 217
    .local v1, s:I
    if-eq v1, v3, :cond_2

    .line 218
    invoke-virtual {p0, v4, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p0

    .line 221
    .end local v1           #s:I
    :cond_2
    const/16 v2, 0x2e

    invoke-virtual {p0, v2}, Ljava/lang/String;->lastIndexOf(I)I

    move-result v0

    .line 222
    .local v0, end:I
    if-ne v0, v3, :cond_3

    move v2, v4

    .line 223
    goto :goto_0

    .line 226
    :cond_3
    add-int/lit8 v2, v0, 0x1

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v3

    invoke-virtual {p0, v2, v3}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v2

    sget-object v3, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-virtual {v2, v3}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "jad"

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_4

    add-int/lit8 v2, v0, 0x1

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v3

    invoke-virtual {p0, v2, v3}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v2

    sget-object v3, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-virtual {v2, v3}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "jar"

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_5

    :cond_4
    const/4 v2, 0x1

    goto :goto_0

    :cond_5
    move v2, v4

    goto :goto_0
.end method

.method private static loadJadProperties(Ljava/lang/String;)Lorg/microemu/util/JadProperties;
    .locals 7
    .parameter "urlString"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 948
    new-instance v1, Lorg/microemu/util/JadProperties;

    invoke-direct {v1}, Lorg/microemu/util/JadProperties;-><init>()V

    .line 950
    .local v1, properties:Lorg/microemu/util/JadProperties;
    new-instance v2, Ljava/net/URL;

    invoke-direct {v2, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 951
    .local v2, url:Ljava/net/URL;
    invoke-virtual {v2}, Ljava/net/URL;->getUserInfo()Ljava/lang/String;

    move-result-object v4

    if-nez v4, :cond_0

    .line 952
    invoke-virtual {v2}, Ljava/net/URL;->openStream()Ljava/io/InputStream;

    move-result-object v4

    invoke-virtual {v1, v4}, Lorg/microemu/util/JadProperties;->load(Ljava/io/InputStream;)V

    .line 960
    :goto_0
    return-object v1

    .line 954
    :cond_0
    invoke-virtual {v2}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v0

    .line 955
    .local v0, cn:Ljava/net/URLConnection;
    new-instance v3, Ljava/lang/String;

    invoke-virtual {v2}, Ljava/net/URL;->getUserInfo()Ljava/lang/String;

    move-result-object v4

    const-string v5, "UTF-8"

    invoke-virtual {v4, v5}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v4

    invoke-static {v4}, Lorg/microemu/util/Base64Coder;->encode([B)[C

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/String;-><init>([C)V

    .line 956
    .local v3, userInfo:Ljava/lang/String;
    const-string v4, "Authorization"

    new-instance v5, Ljava/lang/StringBuffer;

    invoke-direct {v5}, Ljava/lang/StringBuffer;-><init>()V

    const-string v6, "Basic "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v5

    invoke-virtual {v5, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v0, v4, v5}, Ljava/net/URLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 957
    invoke-virtual {v0}, Ljava/net/URLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v4

    invoke-virtual {v1, v4}, Lorg/microemu/util/JadProperties;->load(Ljava/io/InputStream;)V

    goto :goto_0
.end method

.method private openMIDletUrl(Ljava/lang/String;Lorg/microemu/app/classloader/MIDletClassLoader;)V
    .locals 5
    .parameter "urlString"
    .parameter "midletClassLoader"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const-string v4, "Cannot open jad"

    .line 364
    :try_start_0
    const-string v1, "Loading..."

    invoke-static {v1}, Lorg/microemu/app/Common;->setStatusBar(Ljava/lang/String;)V

    .line 365
    iget-object v1, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    invoke-virtual {v1}, Lorg/microemu/util/JadProperties;->clear()V

    .line 367
    invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v1

    const-string v2, ".jad"

    invoke-virtual {v1, v2}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 368
    const-string v1, "openJad"

    invoke-static {v1, p1}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V

    .line 369
    invoke-static {p1}, Lorg/microemu/app/Common;->loadJadProperties(Ljava/lang/String;)Lorg/microemu/util/JadProperties;

    move-result-object v1

    iput-object v1, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    .line 370
    iget-object v1, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    invoke-virtual {v1}, Lorg/microemu/util/JadProperties;->getJarURL()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, p1, v1, p2}, Lorg/microemu/app/Common;->loadJar(Ljava/lang/String;Ljava/lang/String;Lorg/microemu/app/classloader/MIDletClassLoader;)V

    .line 375
    :goto_0
    invoke-static {}, Lorg/microemu/app/Config;->getUrlsMRU()Lorg/microemu/app/util/MRUList;

    move-result-object v1

    new-instance v2, Lorg/microemu/app/util/MidletURLReference;

    iget-object v3, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    invoke-virtual {v3}, Lorg/microemu/util/JadProperties;->getSuiteName()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3, p1}, Lorg/microemu/app/util/MidletURLReference;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Lorg/microemu/app/util/MRUList;->push(Ljava/lang/Object;)Ljava/lang/Object;

    .line 388
    :goto_1
    return-void

    .line 372
    :cond_0
    const/4 v1, 0x0

    invoke-virtual {p0, v1, p1, p2}, Lorg/microemu/app/Common;->loadJar(Ljava/lang/String;Ljava/lang/String;Lorg/microemu/app/classloader/MIDletClassLoader;)V
    :try_end_0
    .catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_3
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_4

    goto :goto_0

    .line 376
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 377
    .local v0, ex:Ljava/net/MalformedURLException;
    throw v0

    .line 378
    .end local v0           #ex:Ljava/net/MalformedURLException;
    :catch_1
    move-exception v1

    move-object v0, v1

    .line 379
    .local v0, ex:Ljava/lang/ClassNotFoundException;
    invoke-static {v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    .line 380
    new-instance v1, Ljava/io/IOException;

    invoke-virtual {v0}, Ljava/lang/ClassNotFoundException;->getMessage()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 381
    .end local v0           #ex:Ljava/lang/ClassNotFoundException;
    :catch_2
    move-exception v1

    move-object v0, v1

    .line 382
    .local v0, ex:Ljava/io/FileNotFoundException;
    const-string v1, "File Not found"

    invoke-static {v1, p1, v0}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1

    .line 383
    .end local v0           #ex:Ljava/io/FileNotFoundException;
    :catch_3
    move-exception v1

    move-object v0, v1

    .line 384
    .local v0, ex:Ljava/lang/NullPointerException;
    const-string v1, "Cannot open jad"

    invoke-static {v4, p1, v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1

    .line 385
    .end local v0           #ex:Ljava/lang/NullPointerException;
    :catch_4
    move-exception v1

    move-object v0, v1

    .line 386
    .local v0, ex:Ljava/lang/IllegalArgumentException;
    const-string v1, "Cannot open jad"

    invoke-static {v4, p1, v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1
.end method

.method public static openMIDletUrlSafe(Ljava/lang/String;)V
    .locals 3
    .parameter "urlString"

    .prologue
    .line 236
    :try_start_0
    invoke-static {}, Lorg/microemu/app/Common;->getInstance()Lorg/microemu/app/Common;

    move-result-object v1

    invoke-virtual {v1, p0}, Lorg/microemu/app/Common;->openMIDletUrl(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 240
    :goto_0
    return-void

    .line 237
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 238
    .local v0, e:Ljava/io/IOException;
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    const-string v2, "Unable to open jad "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1, v0}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method private runAutoTests(Ljava/lang/String;Z)V
    .locals 6
    .parameter "urlString"
    .parameter "exitAtTheEnd"

    .prologue
    .line 252
    invoke-static {}, Lorg/microemu/app/Common;->getInstance()Lorg/microemu/app/Common;

    move-result-object v3

    .line 253
    .local v3, common:Lorg/microemu/app/Common;
    new-instance v0, Lorg/microemu/app/Common$1;

    const-string v2, "AutoTestsThread"

    move-object v1, p0

    move-object v4, p1

    move v5, p2

    invoke-direct/range {v0 .. v5}, Lorg/microemu/app/Common$1;-><init>(Lorg/microemu/app/Common;Ljava/lang/String;Lorg/microemu/app/Common;Ljava/lang/String;Z)V

    .line 327
    .local v0, t:Ljava/lang/Thread;
    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    .line 328
    return-void
.end method

.method private setResponseInterface(Z)V
    .locals 1
    .parameter "state"

    .prologue
    .line 654
    iget-object v0, p0, Lorg/microemu/app/Common;->responseInterfaceListener:Lorg/microemu/app/ui/ResponseInterfaceListener;

    if-eqz v0, :cond_0

    .line 655
    iget-object v0, p0, Lorg/microemu/app/Common;->responseInterfaceListener:Lorg/microemu/app/ui/ResponseInterfaceListener;

    invoke-interface {v0, p1}, Lorg/microemu/app/ui/ResponseInterfaceListener;->stateChanged(Z)V

    .line 657
    :cond_0
    return-void
.end method

.method public static setStatusBar(Ljava/lang/String;)V
    .locals 1
    .parameter "text"

    .prologue
    .line 648
    sget-object v0, Lorg/microemu/app/Common;->statusBarListener:Lorg/microemu/app/ui/StatusBarListener;

    if-eqz v0, :cond_0

    .line 649
    sget-object v0, Lorg/microemu/app/Common;->statusBarListener:Lorg/microemu/app/ui/StatusBarListener;

    invoke-interface {v0, p0}, Lorg/microemu/app/ui/StatusBarListener;->statusBarChanged(Ljava/lang/String;)V

    .line 651
    :cond_0
    return-void
.end method

.method private startMidlet(Ljava/lang/Class;Lorg/microemu/MIDletAccess;)Lorg/microemu/MIDletContext;
    .locals 10
    .parameter "midletClass"
    .parameter "previousMidletAccess"

    .prologue
    const/4 v9, 0x0

    const-string v6, "Error starting MIDlet"

    .line 392
    if-eqz p2, :cond_0

    .line 393
    const/4 v6, 0x1

    :try_start_0
    invoke-virtual {p2, v6}, Lorg/microemu/MIDletAccess;->destroyApp(Z)V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    .line 399
    :cond_0
    :goto_0
    new-instance v1, Lorg/microemu/MIDletContext;

    invoke-direct {v1}, Lorg/microemu/MIDletContext;-><init>()V

    .line 400
    .local v1, context:Lorg/microemu/MIDletContext;
    invoke-static {v1}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    .line 401
    invoke-static {}, Lorg/microemu/MIDletBridge;->getRecordStoreManager()Lorg/microemu/RecordStoreManager;

    move-result-object v6

    invoke-static {}, Lorg/microemu/MIDletBridge;->getMicroEmulator()Lorg/microemu/MicroEmulator;

    move-result-object v7

    invoke-interface {v6, v7}, Lorg/microemu/RecordStoreManager;->init(Lorg/microemu/MicroEmulator;)V

    .line 405
    :try_start_1
    const-string v3, "Error starting MIDlet"
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 408
    .local v3, errorTitle:Ljava/lang/String;
    :try_start_2
    invoke-virtual {p1}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;

    move-result-object v5

    .line 409
    .local v5, object:Ljava/lang/Object;
    instance-of v6, v5, Ljavax/microedition/midlet/MIDlet;

    if-nez v6, :cond_1

    .line 410
    const-string v6, "Error starting MIDlet"

    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Class "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    const-string v8, " should extend MIDlet"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_2

    .line 436
    invoke-static {v9}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    move-object v6, v9

    .end local v5           #object:Ljava/lang/Object;
    :goto_1
    return-object v6

    .line 395
    .end local v1           #context:Lorg/microemu/MIDletContext;
    .end local v3           #errorTitle:Ljava/lang/String;
    :catch_0
    move-exception v2

    .line 396
    .local v2, e:Ljava/lang/Throwable;
    new-instance v6, Ljava/lang/StringBuffer;

    invoke-direct {v6}, Ljava/lang/StringBuffer;-><init>()V

    const-string v7, "Unable to destroy MIDlet, "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v6

    invoke-static {v2}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v6, v2}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 413
    .end local v2           #e:Ljava/lang/Throwable;
    .restart local v1       #context:Lorg/microemu/MIDletContext;
    .restart local v3       #errorTitle:Ljava/lang/String;
    .restart local v5       #object:Ljava/lang/Object;
    :cond_1
    :try_start_3
    move-object v0, v5

    check-cast v0, Ljavax/microedition/midlet/MIDlet;

    move-object v4, v0
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_3} :catch_2

    .line 421
    .local v4, m:Ljavax/microedition/midlet/MIDlet;
    :try_start_4
    invoke-virtual {v1}, Lorg/microemu/MIDletContext;->getMIDlet()Ljavax/microedition/midlet/MIDlet;

    move-result-object v6

    if-eq v6, v4, :cond_2

    .line 422
    new-instance v6, Ljava/lang/Error;

    const-string v7, "MIDlet Context corrupted"

    invoke-direct {v6, v7}, Ljava/lang/Error;-><init>(Ljava/lang/String;)V

    throw v6
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_4} :catch_1

    .line 429
    :catch_1
    move-exception v6

    move-object v2, v6

    .line 430
    .restart local v2       #e:Ljava/lang/Throwable;
    :try_start_5
    const-string v6, "Error starting MIDlet"

    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Unable to start MIDlet, "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-static {v2}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7, v2}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 431
    invoke-static {v1}, Lorg/microemu/MIDletBridge;->destroyMIDletContext(Lorg/microemu/MIDletContext;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    .line 436
    invoke-static {v9}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    move-object v6, v9

    goto :goto_1

    .line 414
    .end local v5           #object:Ljava/lang/Object;
    .end local v4           #m:Ljavax/microedition/midlet/MIDlet;
    .end local v2           #e:Ljava/lang/Throwable;
    :catch_2
    move-exception v6

    move-object v2, v6

    .line 415
    .restart local v2       #e:Ljava/lang/Throwable;
    :try_start_6
    const-string v6, "Error starting MIDlet"

    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Unable to create MIDlet, "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-static {v2}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7, v2}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 416
    invoke-static {v1}, Lorg/microemu/MIDletBridge;->destroyMIDletContext(Lorg/microemu/MIDletContext;)V
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_0

    .line 436
    invoke-static {v9}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    move-object v6, v9

    goto :goto_1

    .line 424
    .end local v2           #e:Ljava/lang/Throwable;
    .restart local v4       #m:Ljavax/microedition/midlet/MIDlet;
    .restart local v5       #object:Ljava/lang/Object;
    :cond_2
    :try_start_7
    invoke-virtual {v1}, Lorg/microemu/MIDletContext;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v6

    invoke-virtual {v6}, Lorg/microemu/MIDletAccess;->startApp()V

    .line 426
    sget-object v6, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    invoke-virtual {v6, v4}, Lorg/microemu/app/launcher/Launcher;->setCurrentMIDlet(Ljavax/microedition/midlet/MIDlet;)V

    .line 427
    invoke-virtual {p0}, Lorg/microemu/app/Common;->notifyImplementationMIDletStart()V
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_7} :catch_1

    .line 436
    invoke-static {v9}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    move-object v6, v1

    goto/16 :goto_1

    .end local v3           #errorTitle:Ljava/lang/String;
    .end local v4           #m:Ljavax/microedition/midlet/MIDlet;
    .end local v5           #object:Ljava/lang/Object;
    :catchall_0
    move-exception v6

    invoke-static {v9}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    throw v6
.end method

.method public static usage()Ljava/lang/String;
    .locals 1

    .prologue
    .line 1033
    const-string v0, "[(-d | --device) ({device descriptor} | {device class name}) ] \n[--rms (file | memory)] \n[--id EmulatorID ] \n[--impl {JSR implementation class name}]\n[(--classpath|-cp) <JSR CLASSPATH>]\n[(--appclasspath|--appcp) <MIDlet CLASSPATH>]\n[--appclass <library class name>]\n[--appclassloader strict|relaxed|delegating|system] \n[-Xautotest:<JAD file url>\n[--quit]\n[--traceClassLoading\n[--traceSystemClassLoading]\n[--enhanceCatchBlock]\n](({MIDlet class name} [--propertiesjad {jad file location}]) | {jad file location} | {jar file location})"

    return-object v0
.end method


# virtual methods
.method public checkPermission(Ljava/lang/String;)I
    .locals 1
    .parameter "permission"

    .prologue
    .line 477
    invoke-static {p1}, Lorg/microemu/app/util/MIDletSystemProperties;->getPermission(Ljava/lang/String;)I

    move-result v0

    return v0
.end method

.method protected describeJarProblem(Ljava/net/URL;Lorg/microemu/app/classloader/MIDletClassLoader;)Z
    .locals 10
    .parameter "jarUrl"
    .parameter "midletClassLoader"

    .prologue
    const/4 v9, 0x1

    const-string v7, "Problem reading jar "

    .line 496
    const/4 v3, 0x0

    .line 497
    .local v3, is:Ljava/io/InputStream;
    const/4 v4, 0x0

    .line 499
    .local v4, jis:Ljava/util/jar/JarInputStream;
    :try_start_0
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Unable to open jar "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v6

    .line 502
    .local v6, message:Ljava/lang/String;
    :try_start_1
    invoke-virtual {p1}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v0

    .line 508
    .local v0, conn:Ljava/net/URLConnection;
    :try_start_2
    invoke-virtual {v0}, Ljava/net/URLConnection;->getInputStream()Ljava/io/InputStream;
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2

    move-result-object v3

    .line 517
    :try_start_3
    new-instance v5, Ljava/util/jar/JarInputStream;

    invoke-direct {v5, v3}, Ljava/util/jar/JarInputStream;-><init>(Ljava/io/InputStream;)V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_3

    .line 523
    .end local v4           #jis:Ljava/util/jar/JarInputStream;
    .local v5, jis:Ljava/util/jar/JarInputStream;
    :try_start_4
    invoke-virtual {v5}, Ljava/util/jar/JarInputStream;->getNextJarEntry()Ljava/util/jar/JarEntry;

    move-result-object v2

    .line 524
    .local v2, entry:Ljava/util/jar/JarEntry;
    if-nez v2, :cond_0

    .line 525
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Empty jar "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;)V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1
    .catch Ljava/util/zip/ZipException; {:try_start_4 .. :try_end_4} :catch_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_5

    .line 541
    invoke-static {v5}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move-object v4, v5

    .restart local v4       #jis:Ljava/util/jar/JarInputStream;
    move v7, v9

    .end local v0           #conn:Ljava/net/URLConnection;
    .end local v5           #jis:Ljava/util/jar/JarInputStream;
    .end local v2           #entry:Ljava/util/jar/JarEntry;
    :goto_0
    return v7

    .line 503
    :catch_0
    move-exception v1

    .line 504
    .local v1, e:Ljava/io/IOException;
    :try_start_5
    invoke-static {v6, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    .line 541
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move v7, v9

    goto :goto_0

    .line 509
    .end local v1           #e:Ljava/io/IOException;
    .restart local v0       #conn:Ljava/net/URLConnection;
    :catch_1
    move-exception v1

    .line 510
    .local v1, e:Ljava/io/FileNotFoundException;
    :try_start_6
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "The system cannot find the jar file "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_0

    .line 541
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move v7, v9

    goto :goto_0

    .line 512
    .end local v1           #e:Ljava/io/FileNotFoundException;
    :catch_2
    move-exception v1

    .line 513
    .local v1, e:Ljava/io/IOException;
    :try_start_7
    invoke-static {v6, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_0

    .line 541
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move v7, v9

    goto :goto_0

    .line 518
    .end local v1           #e:Ljava/io/IOException;
    :catch_3
    move-exception v7

    move-object v1, v7

    .line 519
    .restart local v1       #e:Ljava/io/IOException;
    :try_start_8
    invoke-static {v6, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_0

    .line 541
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move v7, v9

    goto :goto_0

    .line 529
    .end local v4           #jis:Ljava/util/jar/JarInputStream;
    .end local v1           #e:Ljava/io/IOException;
    .restart local v2       #entry:Ljava/util/jar/JarEntry;
    .restart local v5       #jis:Ljava/util/jar/JarInputStream;
    :cond_0
    :try_start_9
    invoke-virtual {v5}, Ljava/util/jar/JarInputStream;->getNextJarEntry()Ljava/util/jar/JarEntry;
    :try_end_9
    .catchall {:try_start_9 .. :try_end_9} :catchall_1
    .catch Ljava/util/zip/ZipException; {:try_start_9 .. :try_end_9} :catch_4
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_5

    move-result-object v7

    if-nez v7, :cond_0

    .line 539
    const/4 v7, 0x0

    .line 541
    invoke-static {v5}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move-object v4, v5

    .restart local v4       #jis:Ljava/util/jar/JarInputStream;
    goto :goto_0

    .line 531
    .end local v2           #entry:Ljava/util/jar/JarEntry;
    .end local v4           #jis:Ljava/util/jar/JarInputStream;
    :catch_4
    move-exception v7

    move-object v1, v7

    .line 532
    .local v1, e:Ljava/util/zip/ZipException;
    :try_start_a
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Problem reading jar "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_a
    .catchall {:try_start_a .. :try_end_a} :catchall_1

    .line 541
    invoke-static {v5}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move-object v4, v5

    .restart local v4       #jis:Ljava/util/jar/JarInputStream;
    move v7, v9

    goto :goto_0

    .line 534
    .end local v1           #e:Ljava/util/zip/ZipException;
    .end local v4           #jis:Ljava/util/jar/JarInputStream;
    :catch_5
    move-exception v7

    move-object v1, v7

    .line 535
    .local v1, e:Ljava/io/IOException;
    :try_start_b
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    const-string v8, "Problem reading jar "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_b
    .catchall {:try_start_b .. :try_end_b} :catchall_1

    .line 541
    invoke-static {v5}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    move-object v4, v5

    .restart local v4       #jis:Ljava/util/jar/JarInputStream;
    move v7, v9

    goto/16 :goto_0

    .line 541
    .end local v6           #message:Ljava/lang/String;
    .end local v0           #conn:Ljava/net/URLConnection;
    .end local v5           #jis:Ljava/util/jar/JarInputStream;
    .end local v1           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v7

    :goto_1
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 542
    invoke-static {v3}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    throw v7

    .line 541
    .end local v4           #jis:Ljava/util/jar/JarInputStream;
    .restart local v0       #conn:Ljava/net/URLConnection;
    .restart local v5       #jis:Ljava/util/jar/JarInputStream;
    .restart local v6       #message:Ljava/lang/String;
    :catchall_1
    move-exception v7

    move-object v4, v5

    .restart local v4       #jis:Ljava/util/jar/JarInputStream;
    goto :goto_1
.end method

.method public destroyMIDletContext(Lorg/microemu/MIDletContext;)V
    .locals 2
    .parameter "midletContext"

    .prologue
    .line 183
    if-eqz p1, :cond_0

    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletContext()Lorg/microemu/MIDletContext;

    move-result-object v0

    if-ne v0, p1, :cond_0

    invoke-virtual {p1}, Lorg/microemu/MIDletContext;->isLauncher()Z

    move-result v0

    if-nez v0, :cond_0

    .line 185
    const-string v0, "destroyMIDletContext"

    invoke-static {v0}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;)V

    .line 187
    :cond_0
    invoke-static {p1}, Lorg/microemu/app/util/MIDletThread;->contextDestroyed(Lorg/microemu/MIDletContext;)V

    .line 188
    iget-object v0, p0, Lorg/microemu/app/Common;->destroyNotify:Ljava/lang/Object;

    monitor-enter v0

    .line 189
    :try_start_0
    iget-object v1, p0, Lorg/microemu/app/Common;->destroyNotify:Ljava/lang/Object;

    invoke-virtual {v1}, Ljava/lang/Object;->notifyAll()V

    .line 190
    monitor-exit v0

    .line 191
    return-void

    .line 190
    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public getAppProperty(Ljava/lang/String;)Ljava/lang/String;
    .locals 2
    .parameter "key"

    .prologue
    .line 152
    const-string v1, "microedition.platform"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 153
    const-string v1, "MicroEmulator"

    .line 169
    :goto_0
    return-object v1

    .line 154
    :cond_0
    const-string v1, "microedition.profiles"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 155
    const-string v1, "MIDP-2.0"

    goto :goto_0

    .line 156
    :cond_1
    const-string v1, "microedition.configuration"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 157
    const-string v1, "CLDC-1.0"

    goto :goto_0

    .line 158
    :cond_2
    const-string v1, "microedition.locale"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3

    .line 159
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;

    move-result-object v1

    goto :goto_0

    .line 160
    :cond_3
    const-string v1, "microedition.encoding"

    invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_4

    .line 161
    const-string v1, "file.encoding"

    invoke-static {v1}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    goto :goto_0

    .line 164
    :cond_4
    iget-object v1, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    invoke-virtual {v1, p1}, Lorg/microemu/util/JadProperties;->getProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 165
    .local v0, result:Ljava/lang/String;
    if-nez v0, :cond_5

    .line 166
    iget-object v1, p0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    invoke-virtual {v1, p1}, Lorg/microemu/util/JadProperties;->getProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :cond_5
    move-object v1, v0

    .line 169
    goto :goto_0
.end method

.method public getDevice()Lorg/microemu/device/Device;
    .locals 1

    .prologue
    .line 635
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v0

    return-object v0
.end method

.method public getLauncher()Lorg/microemu/app/launcher/Launcher;
    .locals 1

    .prologue
    .line 194
    sget-object v0, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    return-object v0
.end method

.method public getRecordStoreManager()Lorg/microemu/RecordStoreManager;
    .locals 1

    .prologue
    .line 144
    iget-object v0, p0, Lorg/microemu/app/Common;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    return-object v0
.end method

.method public getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;
    .locals 1
    .parameter "name"

    .prologue
    .line 173
    iget-object v0, p0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    invoke-interface {v0, p1}, Lorg/microemu/EmulatorContext;->getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    return-object v0
.end method

.method protected handleStartMidletException(Ljava/lang/Throwable;)V
    .locals 0
    .parameter "e"

    .prologue
    .line 490
    return-void
.end method

.method public initMIDlet(Z)V
    .locals 11
    .parameter "startMidlet"

    .prologue
    .line 964
    const/4 v5, 0x0

    .line 966
    .local v5, midletClass:Ljava/lang/Class;
    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    if-eqz v8, :cond_3

    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-static {v8}, Lorg/microemu/app/Common;->isMIDletUrlExtension(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_3

    .line 968
    :try_start_0
    new-instance v4, Ljava/io/File;

    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-direct {v4, v8}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 969
    .local v4, file:Ljava/io/File;
    invoke-virtual {v4}, Ljava/io/File;->exists()Z

    move-result v8

    if-eqz v8, :cond_2

    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->getCanonicalFileURL(Ljava/io/File;)Ljava/lang/String;

    move-result-object v8

    move-object v7, v8

    .line 970
    .local v7, url:Ljava/lang/String;
    :goto_0
    invoke-virtual {p0, v7}, Lorg/microemu/app/Common;->openMIDletUrl(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 1001
    .end local v4           #file:Ljava/io/File;
    .end local v7           #url:Ljava/lang/String;
    :cond_0
    :goto_1
    iget-boolean v8, p0, Lorg/microemu/app/Common;->autoTests:Z

    if-eqz v8, :cond_5

    .line 1002
    iget-object v8, p0, Lorg/microemu/app/Common;->jadURL:Ljava/lang/String;

    if-eqz v8, :cond_1

    .line 1003
    iget-object v8, p0, Lorg/microemu/app/Common;->jadURL:Ljava/lang/String;

    const/4 v9, 0x1

    invoke-direct {p0, v8, v9}, Lorg/microemu/app/Common;->runAutoTests(Ljava/lang/String;Z)V

    .line 1030
    :cond_1
    :goto_2
    return-void

    .line 969
    .restart local v4       #file:Ljava/io/File;
    :cond_2
    :try_start_1
    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    move-object v7, v8

    goto :goto_0

    .line 971
    .end local v4           #file:Ljava/io/File;
    :catch_0
    move-exception v8

    move-object v3, v8

    .line 972
    .local v3, exception:Ljava/io/IOException;
    new-instance v8, Ljava/lang/StringBuffer;

    invoke-direct {v8}, Ljava/lang/StringBuffer;-><init>()V

    const-string v9, "Cannot load "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    iget-object v9, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    const-string v9, " URL"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8, v3}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1

    .line 974
    .end local v3           #exception:Ljava/io/IOException;
    :cond_3
    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    if-eqz v8, :cond_0

    .line 975
    iget-object v8, p0, Lorg/microemu/app/Common;->mIDletClassLoaderConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

    invoke-virtual {v8}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->isClassLoaderDisabled()Z

    move-result v8

    iput-boolean v8, p0, Lorg/microemu/app/Common;->useSystemClassLoader:Z

    .line 976
    iget-boolean v8, p0, Lorg/microemu/app/Common;->useSystemClassLoader:Z

    if-nez v8, :cond_4

    .line 977
    const/4 v8, 0x0

    invoke-direct {p0, v8}, Lorg/microemu/app/Common;->createMIDletClassLoader(Z)Lorg/microemu/app/classloader/MIDletClassLoader;

    move-result-object v0

    .line 979
    .local v0, classLoader:Lorg/microemu/app/classloader/MIDletClassLoader;
    :try_start_2
    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-virtual {v0, v8}, Lorg/microemu/app/classloader/MIDletClassLoader;->addClassURL(Ljava/lang/String;)V

    .line 980
    iget-object v8, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-virtual {v0, v8}, Lorg/microemu/app/classloader/MIDletClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_2
    .catch Ljava/net/MalformedURLException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/lang/NoClassDefFoundError; {:try_start_2 .. :try_end_2} :catch_2
    .catch Ljava/lang/ClassNotFoundException; {:try_start_2 .. :try_end_2} :catch_3

    move-result-object v5

    goto :goto_1

    .line 981
    :catch_1
    move-exception v8

    move-object v1, v8

    .line 982
    .local v1, e:Ljava/net/MalformedURLException;
    const-string v8, "Error"

    new-instance v9, Ljava/lang/StringBuffer;

    invoke-direct {v9}, Ljava/lang/StringBuffer;-><init>()V

    const-string v10, "Unable to find MIDlet class, "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-static {v1}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2

    .line 984
    .end local v1           #e:Ljava/net/MalformedURLException;
    :catch_2
    move-exception v8

    move-object v1, v8

    .line 985
    .local v1, e:Ljava/lang/NoClassDefFoundError;
    const-string v8, "Error"

    new-instance v9, Ljava/lang/StringBuffer;

    invoke-direct {v9}, Ljava/lang/StringBuffer;-><init>()V

    const-string v10, "Unable to find MIDlet class, "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-static {v1}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_2

    .line 987
    .end local v1           #e:Ljava/lang/NoClassDefFoundError;
    :catch_3
    move-exception v8

    move-object v1, v8

    .line 988
    .local v1, e:Ljava/lang/ClassNotFoundException;
    const-string v8, "Error"

    new-instance v9, Ljava/lang/StringBuffer;

    invoke-direct {v9}, Ljava/lang/StringBuffer;-><init>()V

    const-string v10, "Unable to find MIDlet class, "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-static {v1}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_2

    .line 993
    .end local v0           #classLoader:Lorg/microemu/app/classloader/MIDletClassLoader;
    .end local v1           #e:Ljava/lang/ClassNotFoundException;
    :cond_4
    :try_start_3
    sget-object v8, Lorg/microemu/app/Common;->instance:Lorg/microemu/app/Common;

    invoke-virtual {v8}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;

    move-result-object v8

    iget-object v9, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/ClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_3
    .catch Ljava/lang/ClassNotFoundException; {:try_start_3 .. :try_end_3} :catch_4

    move-result-object v5

    .restart local v5       #midletClass:Ljava/lang/Class;
    goto/16 :goto_1

    .line 994
    :catch_4
    move-exception v8

    move-object v1, v8

    .line 995
    .restart local v1       #e:Ljava/lang/ClassNotFoundException;
    const-string v8, "Error"

    new-instance v9, Ljava/lang/StringBuffer;

    invoke-direct {v9}, Ljava/lang/StringBuffer;-><init>()V

    const-string v10, "Unable to find MIDlet class, "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-static {v1}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto/16 :goto_2

    .line 1007
    .end local v1           #e:Ljava/lang/ClassNotFoundException;
    :cond_5
    if-eqz v5, :cond_6

    iget-object v8, p0, Lorg/microemu/app/Common;->propertiesJad:Ljava/lang/String;

    if-eqz v8, :cond_6

    .line 1009
    :try_start_4
    iget-object v8, p0, Lorg/microemu/app/Common;->propertiesJad:Ljava/lang/String;

    invoke-static {v8}, Lorg/microemu/app/Common;->loadJadProperties(Ljava/lang/String;)Lorg/microemu/util/JadProperties;

    move-result-object v8

    iput-object v8, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_5

    .line 1015
    :cond_6
    :goto_3
    const/4 v6, 0x0

    .line 1017
    .local v6, started:Z
    if-nez v5, :cond_9

    .line 1018
    sget-object v8, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    invoke-virtual {v8}, Lorg/microemu/app/launcher/Launcher;->getSelectedMidletEntry()Lorg/microemu/MIDletEntry;

    move-result-object v2

    .line 1019
    .local v2, entry:Lorg/microemu/MIDletEntry;
    if-eqz p1, :cond_7

    if-eqz v2, :cond_7

    .line 1020
    invoke-virtual {v2}, Lorg/microemu/MIDletEntry;->getMIDletClass()Ljava/lang/Class;

    move-result-object v8

    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v9

    invoke-direct {p0, v8, v9}, Lorg/microemu/app/Common;->startMidlet(Ljava/lang/Class;Lorg/microemu/MIDletAccess;)Lorg/microemu/MIDletContext;

    move-result-object v8

    if-eqz v8, :cond_8

    const/4 v8, 0x1

    move v6, v8

    .line 1025
    .end local v2           #entry:Lorg/microemu/MIDletEntry;
    :cond_7
    :goto_4
    if-nez v6, :cond_1

    .line 1026
    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletContext()Lorg/microemu/MIDletContext;

    move-result-object v8

    invoke-virtual {p0, v8}, Lorg/microemu/app/Common;->startLauncher(Lorg/microemu/MIDletContext;)V

    goto/16 :goto_2

    .line 1010
    .end local v6           #started:Z
    :catch_5
    move-exception v8

    move-object v1, v8

    .line 1011
    .local v1, e:Ljava/io/IOException;
    new-instance v8, Ljava/lang/StringBuffer;

    invoke-direct {v8}, Ljava/lang/StringBuffer;-><init>()V

    const-string v9, "Cannot load "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    iget-object v9, p0, Lorg/microemu/app/Common;->propertiesJad:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    const-string v9, " URL"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8, v1}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_3

    .line 1020
    .end local v1           #e:Ljava/io/IOException;
    .restart local v2       #entry:Lorg/microemu/MIDletEntry;
    .restart local v6       #started:Z
    :cond_8
    const/4 v8, 0x0

    move v6, v8

    goto :goto_4

    .line 1023
    .end local v2           #entry:Lorg/microemu/MIDletEntry;
    :cond_9
    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v8

    invoke-direct {p0, v5, v8}, Lorg/microemu/app/Common;->startMidlet(Ljava/lang/Class;Lorg/microemu/MIDletAccess;)Lorg/microemu/MIDletContext;

    move-result-object v8

    if-eqz v8, :cond_a

    const/4 v8, 0x1

    move v6, v8

    .restart local v6       #started:Z
    :goto_5
    goto :goto_4

    :cond_a
    const/4 v8, 0x0

    move v6, v8

    goto :goto_5
.end method

.method public initParams(Ljava/util/List;Lorg/microemu/app/util/DeviceEntry;Ljava/lang/Class;)V
    .locals 24
    .parameter "params"
    .parameter "defaultDevice"
    .parameter "defaultDeviceClass"

    .prologue
    .line 743
    new-instance v6, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

    invoke-direct {v6}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;-><init>()V

    .line 744
    .local v6, clConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;
    const/4 v11, 0x0

    .line 745
    .local v11, deviceClass:Ljava/lang/Class;
    const/4 v12, 0x0

    .line 746
    .local v12, deviceDescriptorLocation:Ljava/lang/String;
    const/16 v16, 0x0

    .line 748
    .local v16, paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    invoke-interface/range {p1 .. p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v5

    .line 751
    .end local p1
    .local v5, argsIterator:Ljava/util/Iterator;
    :cond_0
    :goto_0
    :try_start_0
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v20

    if-eqz v20, :cond_e

    .line 752
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Ljava/lang/String;

    .line 753
    .local v4, arg:Ljava/lang/String;
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    .line 755
    const-string v20, "--help"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_1

    const-string v20, "-help"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_3

    .line 756
    :cond_1
    sget-object v20, Ljava/lang/System;->out:Ljava/io/PrintStream;

    invoke-static {}, Lorg/microemu/app/Common;->usage()Ljava/lang/String;

    move-result-object v21

    invoke-virtual/range {v20 .. v21}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 757
    const/16 v20, 0x0

    invoke-static/range {v20 .. v20}, Ljava/lang/System;->exit(I)V
    :try_end_0
    .catch Lorg/microemu/app/ConfigurationException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 843
    .end local v16           #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    .end local v4           #arg:Ljava/lang/String;
    :catch_0
    move-exception v20

    move-object/from16 v13, v20

    .line 844
    .local v13, e:Lorg/microemu/app/ConfigurationException;
    const-string v20, "Error"

    invoke-virtual {v13}, Lorg/microemu/app/ConfigurationException;->getMessage()Ljava/lang/String;

    move-result-object v21

    move-object/from16 v0, v20

    move-object/from16 v1, v21

    move-object v2, v13

    invoke-static {v0, v1, v2}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 913
    .end local v13           #e:Lorg/microemu/app/ConfigurationException;
    :cond_2
    :goto_1
    return-void

    .line 758
    .restart local v4       #arg:Ljava/lang/String;
    .restart local v16       #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    :cond_3
    :try_start_1
    const-string v20, "--id"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_4

    .line 759
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    invoke-static/range {p1 .. p1}, Lorg/microemu/app/Config;->setEmulatorID(Ljava/lang/String;)V

    .line 760
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto :goto_0

    .line 761
    :cond_4
    const-string v20, "--appclasspath"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_5

    const-string v20, "-appclasspath"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_5

    const-string v20, "-appcp"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_7

    .line 762
    :cond_5
    if-nez v6, :cond_6

    .line 763
    new-instance v20, Lorg/microemu/app/ConfigurationException;

    const-string v21, "Wrong command line argument order"

    invoke-direct/range {v20 .. v21}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v20

    .line 765
    :cond_6
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    move-object v0, v6

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->addAppClassPath(Ljava/lang/String;)V

    .line 766
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto/16 :goto_0

    .line 767
    :cond_7
    const-string v20, "--appclass"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_9

    .line 768
    if-nez v6, :cond_8

    .line 769
    new-instance v20, Lorg/microemu/app/ConfigurationException;

    const-string v21, "Wrong command line argument order"

    invoke-direct/range {v20 .. v21}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v20

    .line 771
    :cond_8
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    move-object v0, v6

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->addAppClass(Ljava/lang/String;)V

    .line 772
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto/16 :goto_0

    .line 773
    :cond_9
    const-string v20, "-Xautotest:"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v20

    if-eqz v20, :cond_a

    .line 774
    const/16 v20, 0x1

    move/from16 v0, v20

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lorg/microemu/app/Common;->autoTests:Z

    .line 775
    const-string v20, "-Xautotest:"

    invoke-virtual/range {v20 .. v20}, Ljava/lang/String;->length()I

    move-result v20

    move-object v0, v4

    move/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v20

    move-object/from16 v0, v20

    move-object/from16 v1, p0

    iput-object v0, v1, Lorg/microemu/app/Common;->jadURL:Ljava/lang/String;

    goto/16 :goto_0

    .line 776
    :cond_a
    const-string v20, "-Xautotest"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_b

    .line 777
    const/16 v20, 0x1

    move/from16 v0, v20

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lorg/microemu/app/Common;->autoTests:Z

    goto/16 :goto_0

    .line 778
    :cond_b
    const-string v20, "--propertiesjad"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_d

    .line 779
    new-instance v15, Ljava/io/File;

    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    move-object v0, v15

    move-object/from16 v1, p1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 780
    .local v15, file:Ljava/io/File;
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    .line 781
    invoke-virtual {v15}, Ljava/io/File;->exists()Z

    move-result v20

    if-eqz v20, :cond_c

    invoke-static {v15}, Lorg/microemu/app/util/IOUtils;->getCanonicalFileURL(Ljava/io/File;)Ljava/lang/String;

    move-result-object v20

    :goto_2
    move-object/from16 v0, v20

    move-object/from16 v1, p0

    iput-object v0, v1, Lorg/microemu/app/Common;->propertiesJad:Ljava/lang/String;

    goto/16 :goto_0

    :cond_c
    move-object/from16 v20, v4

    goto :goto_2

    .line 782
    .end local v15           #file:Ljava/io/File;
    :cond_d
    const-string v20, "--appclassloader"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_14

    .line 783
    if-nez v6, :cond_13

    .line 784
    const-string v20, "Error"

    const-string v21, "Wrong command line argument order"

    invoke-static/range {v20 .. v21}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catch Lorg/microemu/app/ConfigurationException; {:try_start_1 .. :try_end_1} :catch_0

    .line 848
    .end local v4           #arg:Ljava/lang/String;
    :cond_e
    move-object v0, v6

    move-object/from16 v1, p0

    iput-object v0, v1, Lorg/microemu/app/Common;->mIDletClassLoaderConfig:Lorg/microemu/app/classloader/MIDletClassLoaderConfig;

    .line 852
    invoke-static {}, Lorg/microemu/app/Common;->getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;

    move-result-object v7

    .line 853
    .local v7, classLoader:Ljava/lang/ClassLoader;
    if-eqz v12, :cond_f

    .line 855
    :try_start_2
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    move-object/from16 v20, v0

    move-object/from16 v0, v20

    move-object v1, v7

    move-object v2, v12

    move-object/from16 v3, p3

    invoke-static {v0, v1, v2, v3}, Lorg/microemu/device/impl/DeviceImpl;->create(Lorg/microemu/EmulatorContext;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;)Lorg/microemu/device/impl/DeviceImpl;

    move-result-object v20

    move-object/from16 v0, p0

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->setDevice(Lorg/microemu/device/Device;)V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1

    .line 860
    :cond_f
    :goto_3
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v20

    if-nez v20, :cond_11

    .line 862
    if-nez v11, :cond_25

    .line 863
    :try_start_3
    invoke-virtual/range {p2 .. p2}, Lorg/microemu/app/util/DeviceEntry;->getFileName()Ljava/lang/String;

    move-result-object v20

    if-eqz v20, :cond_10

    .line 864
    const/16 v20, 0x1

    move/from16 v0, v20

    new-array v0, v0, [Ljava/net/URL;

    move-object/from16 v19, v0

    .line 865
    .local v19, urls:[Ljava/net/URL;
    const/16 v20, 0x0

    new-instance v21, Ljava/io/File;

    invoke-static {}, Lorg/microemu/app/Config;->getConfigPath()Ljava/io/File;

    move-result-object v22

    invoke-virtual/range {p2 .. p2}, Lorg/microemu/app/util/DeviceEntry;->getFileName()Ljava/lang/String;

    move-result-object v23

    invoke-direct/range {v21 .. v23}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-virtual/range {v21 .. v21}, Ljava/io/File;->toURI()Ljava/net/URI;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/net/URI;->toURL()Ljava/net/URL;

    move-result-object v21

    aput-object v21, v19, v20

    .line 866
    invoke-static/range {v19 .. v19}, Lorg/microemu/app/Common;->createExtensionsClassLoader([Ljava/net/URL;)Ljava/lang/ClassLoader;

    move-result-object v7

    .line 868
    .end local v19           #urls:[Ljava/net/URL;
    :cond_10
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    move-object/from16 v20, v0

    invoke-virtual/range {p2 .. p2}, Lorg/microemu/app/util/DeviceEntry;->getDescriptorLocation()Ljava/lang/String;

    move-result-object v21

    move-object/from16 v0, v20

    move-object v1, v7

    move-object/from16 v2, v21

    move-object/from16 v3, p3

    invoke-static {v0, v1, v2, v3}, Lorg/microemu/device/impl/DeviceImpl;->create(Lorg/microemu/EmulatorContext;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;)Lorg/microemu/device/impl/DeviceImpl;

    move-result-object v20

    move-object/from16 v0, p0

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->setDevice(Lorg/microemu/device/Device;)V
    :try_end_3
    .catch Ljava/lang/InstantiationException; {:try_start_3 .. :try_end_3} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_3 .. :try_end_3} :catch_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_4

    .line 885
    :cond_11
    :goto_4
    :try_start_4
    new-instance v20, Lorg/microemu/app/launcher/Launcher;

    move-object/from16 v0, v20

    move-object/from16 v1, p0

    invoke-direct {v0, v1}, Lorg/microemu/app/launcher/Launcher;-><init>(Lorg/microemu/app/CommonInterface;)V

    sput-object v20, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    .line 886
    sget-object v20, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    sget-object v21, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    invoke-virtual/range {v20 .. v21}, Lorg/microemu/app/launcher/Launcher;->setCurrentMIDlet(Ljavax/microedition/midlet/MIDlet;)V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    .line 888
    const/16 v20, 0x0

    invoke-static/range {v20 .. v20}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    .line 891
    invoke-virtual/range {p0 .. p0}, Lorg/microemu/app/Common;->getRecordStoreManager()Lorg/microemu/RecordStoreManager;

    move-result-object v20

    if-nez v20, :cond_2

    .line 892
    if-nez v16, :cond_26

    .line 893
    invoke-static {}, Lorg/microemu/app/Config;->getRecordStoreManagerClassName()Ljava/lang/String;

    move-result-object v8

    .line 894
    .local v8, className:Ljava/lang/String;
    if-eqz v8, :cond_12

    .line 896
    :try_start_5
    invoke-static {v8}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v9

    .line 897
    .local v9, clazz:Ljava/lang/Class;
    invoke-virtual {v9}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lorg/microemu/RecordStoreManager;

    invoke-virtual/range {p0 .. p1}, Lorg/microemu/app/Common;->setRecordStoreManager(Lorg/microemu/RecordStoreManager;)V
    :try_end_5
    .catch Ljava/lang/ClassNotFoundException; {:try_start_5 .. :try_end_5} :catch_5
    .catch Ljava/lang/InstantiationException; {:try_start_5 .. :try_end_5} :catch_6
    .catch Ljava/lang/IllegalAccessException; {:try_start_5 .. :try_end_5} :catch_7

    .line 906
    .end local v9           #clazz:Ljava/lang/Class;
    :cond_12
    :goto_5
    invoke-virtual/range {p0 .. p0}, Lorg/microemu/app/Common;->getRecordStoreManager()Lorg/microemu/RecordStoreManager;

    move-result-object v20

    if-nez v20, :cond_2

    .line 907
    new-instance v20, Lorg/microemu/app/util/FileRecordStoreManager;

    invoke-direct/range {v20 .. v20}, Lorg/microemu/app/util/FileRecordStoreManager;-><init>()V

    move-object/from16 v0, p0

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->setRecordStoreManager(Lorg/microemu/RecordStoreManager;)V

    goto/16 :goto_1

    .line 787
    .end local v7           #classLoader:Ljava/lang/ClassLoader;
    .end local v8           #className:Ljava/lang/String;
    .restart local v4       #arg:Ljava/lang/String;
    :cond_13
    :try_start_6
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    move-object v0, v6

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->setDelegationType(Ljava/lang/String;)V

    .line 788
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto/16 :goto_0

    .line 789
    :cond_14
    const-string v20, "--usesystemclassloader"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_15

    .line 790
    const/16 v20, 0x1

    move/from16 v0, v20

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lorg/microemu/app/Common;->useSystemClassLoader:Z

    .line 791
    const-string v20, "system"

    move-object v0, v6

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->setDelegationType(Ljava/lang/String;)V

    goto/16 :goto_0

    .line 792
    :cond_15
    const-string v20, "-d"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_16

    const-string v20, "--device"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_18

    .line 793
    :cond_16
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v20

    if-eqz v20, :cond_0

    .line 794
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v17

    check-cast v17, Ljava/lang/String;

    .line 795
    .local v17, tmpDevice:Ljava/lang/String;
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    .line 796
    invoke-virtual/range {v17 .. v17}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v20

    const-string v21, ".xml"

    invoke-virtual/range {v20 .. v21}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
    :try_end_6
    .catch Lorg/microemu/app/ConfigurationException; {:try_start_6 .. :try_end_6} :catch_0

    move-result v20

    if-nez v20, :cond_17

    .line 798
    :try_start_7
    invoke-static/range {v17 .. v17}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
    :try_end_7
    .catch Ljava/lang/ClassNotFoundException; {:try_start_7 .. :try_end_7} :catch_8
    .catch Lorg/microemu/app/ConfigurationException; {:try_start_7 .. :try_end_7} :catch_0

    move-result-object v11

    .line 802
    :cond_17
    :goto_6
    if-nez v11, :cond_0

    .line 803
    move-object/from16 v12, v17

    goto/16 :goto_0

    .line 806
    .end local v17           #tmpDevice:Ljava/lang/String;
    :cond_18
    :try_start_8
    const-string v20, "--rms"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_1a

    .line 807
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v20

    if-eqz v20, :cond_0

    .line 808
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v18

    check-cast v18, Ljava/lang/String;

    .line 809
    .local v18, tmpRms:Ljava/lang/String;
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    .line 810
    const-string v20, "file"

    move-object/from16 v0, v18

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_19

    .line 811
    new-instance v16, Lorg/microemu/app/util/FileRecordStoreManager;

    .end local v16           #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    invoke-direct/range {v16 .. v16}, Lorg/microemu/app/util/FileRecordStoreManager;-><init>()V

    .restart local v16       #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    goto/16 :goto_0

    .line 812
    :cond_19
    const-string v20, "memory"

    move-object/from16 v0, v18

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_0

    .line 813
    new-instance v16, Lorg/microemu/util/MemoryRecordStoreManager;

    .end local v16           #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    invoke-direct/range {v16 .. v16}, Lorg/microemu/util/MemoryRecordStoreManager;-><init>()V

    .restart local v16       #paramRecordStoreManager:Lorg/microemu/RecordStoreManager;
    goto/16 :goto_0

    .line 816
    .end local v18           #tmpRms:Ljava/lang/String;
    :cond_1a
    const-string v20, "--classpath"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_1b

    const-string v20, "-classpath"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_1b

    const-string v20, "-cp"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_1c

    .line 817
    :cond_1b
    invoke-static {}, Lorg/microemu/app/Common;->getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;

    move-result-object v20

    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    move-object/from16 v0, v20

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/ExtensionsClassLoader;->addClasspath(Ljava/lang/String;)V

    .line 818
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto/16 :goto_0

    .line 819
    :cond_1c
    const-string v20, "--impl"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_1d

    .line 820
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    const/16 v20, 0x0

    const/16 v21, 0x1

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, v20

    move/from16 v3, v21

    invoke-virtual {v0, v1, v2, v3}, Lorg/microemu/app/Common;->registerImplementation(Ljava/lang/String;Ljava/util/Map;Z)V

    .line 821
    invoke-interface {v5}, Ljava/util/Iterator;->remove()V

    goto/16 :goto_0

    .line 822
    :cond_1d
    const-string v20, "--quit"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_1e

    .line 823
    const/16 v20, 0x1

    move/from16 v0, v20

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lorg/microemu/app/Common;->exitOnMIDletDestroy:Z

    goto/16 :goto_0

    .line 824
    :cond_1e
    const-string v20, "--logCallLocation"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_1f

    .line 825
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    invoke-static/range {p1 .. p1}, Ljava/lang/Boolean;->valueOf(Ljava/lang/String;)Ljava/lang/Boolean;

    move-result-object v20

    invoke-virtual/range {v20 .. v20}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v20

    invoke-static/range {v20 .. v20}, Lorg/microemu/log/Logger;->setLocationEnabled(Z)V

    goto/16 :goto_0

    .line 826
    :cond_1f
    const-string v20, "--traceClassLoading"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_20

    .line 827
    const/16 v20, 0x1

    sput-boolean v20, Lorg/microemu/app/classloader/MIDletClassLoader;->traceClassLoading:Z

    goto/16 :goto_0

    .line 828
    :cond_20
    const-string v20, "--traceSystemClassLoading"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_21

    .line 829
    const/16 v20, 0x1

    sput-boolean v20, Lorg/microemu/app/classloader/MIDletClassLoader;->traceSystemClassLoading:Z

    goto/16 :goto_0

    .line 830
    :cond_21
    const-string v20, "--enhanceCatchBlock"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_22

    .line 831
    const/16 v20, 0x1

    sput-boolean v20, Lorg/microemu/app/classloader/MIDletClassLoader;->enhanceCatchBlock:Z

    goto/16 :goto_0

    .line 832
    :cond_22
    const-string v20, "--quiet"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-eqz v20, :cond_23

    .line 833
    const/16 v20, 0x0

    sput-boolean v20, Lorg/microemu/log/StdOutAppender;->enabled:Z

    goto/16 :goto_0

    .line 834
    :cond_23
    const-string v20, "--headless"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v20

    if-nez v20, :cond_0

    .line 836
    const-string v20, "--"

    move-object v0, v4

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v20

    if-eqz v20, :cond_24

    .line 838
    new-instance v20, Ljava/lang/StringBuffer;

    invoke-direct/range {v20 .. v20}, Ljava/lang/StringBuffer;-><init>()V

    const-string v21, "Unknown argument "

    invoke-virtual/range {v20 .. v21}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v20

    move-object/from16 v0, v20

    move-object v1, v4

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v20

    invoke-virtual/range {v20 .. v20}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v20

    invoke-static/range {v20 .. v20}, Lorg/microemu/log/Logger;->warn(Ljava/lang/String;)V

    goto/16 :goto_0

    .line 840
    :cond_24
    move-object v0, v4

    move-object/from16 v1, p0

    iput-object v0, v1, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;
    :try_end_8
    .catch Lorg/microemu/app/ConfigurationException; {:try_start_8 .. :try_end_8} :catch_0

    goto/16 :goto_0

    .line 856
    .end local v4           #arg:Ljava/lang/String;
    .restart local v7       #classLoader:Ljava/lang/ClassLoader;
    :catch_1
    move-exception v20

    move-object/from16 v14, v20

    .line 857
    .local v14, ex:Ljava/io/IOException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_3

    .line 871
    .end local v14           #ex:Ljava/io/IOException;
    :cond_25
    :try_start_9
    invoke-virtual {v11}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Lorg/microemu/device/impl/DeviceImpl;

    .line 872
    .local v10, device:Lorg/microemu/device/impl/DeviceImpl;
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    move-object/from16 v20, v0

    move-object v0, v10

    move-object/from16 v1, v20

    invoke-virtual {v0, v1}, Lorg/microemu/device/impl/DeviceImpl;->init(Lorg/microemu/EmulatorContext;)V

    .line 873
    move-object/from16 v0, p0

    move-object v1, v10

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->setDevice(Lorg/microemu/device/Device;)V
    :try_end_9
    .catch Ljava/lang/InstantiationException; {:try_start_9 .. :try_end_9} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_9 .. :try_end_9} :catch_3
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_4

    goto/16 :goto_4

    .line 875
    .end local v10           #device:Lorg/microemu/device/impl/DeviceImpl;
    :catch_2
    move-exception v20

    move-object/from16 v14, v20

    .line 876
    .local v14, ex:Ljava/lang/InstantiationException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_4

    .line 877
    .end local v14           #ex:Ljava/lang/InstantiationException;
    :catch_3
    move-exception v20

    move-object/from16 v14, v20

    .line 878
    .local v14, ex:Ljava/lang/IllegalAccessException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_4

    .line 879
    .end local v14           #ex:Ljava/lang/IllegalAccessException;
    :catch_4
    move-exception v20

    move-object/from16 v14, v20

    .line 880
    .local v14, ex:Ljava/io/IOException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_4

    .line 888
    .end local v14           #ex:Ljava/io/IOException;
    :catchall_0
    move-exception v20

    const/16 v21, 0x0

    invoke-static/range {v21 .. v21}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    throw v20

    .line 898
    .restart local v8       #className:Ljava/lang/String;
    :catch_5
    move-exception v20

    move-object/from16 v14, v20

    .line 899
    .local v14, ex:Ljava/lang/ClassNotFoundException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_5

    .line 900
    .end local v14           #ex:Ljava/lang/ClassNotFoundException;
    :catch_6
    move-exception v20

    move-object/from16 v14, v20

    .line 901
    .local v14, ex:Ljava/lang/InstantiationException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_5

    .line 902
    .end local v14           #ex:Ljava/lang/InstantiationException;
    :catch_7
    move-exception v20

    move-object/from16 v14, v20

    .line 903
    .local v14, ex:Ljava/lang/IllegalAccessException;
    invoke-static {v14}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    goto/16 :goto_5

    .line 910
    .end local v8           #className:Ljava/lang/String;
    .end local v14           #ex:Ljava/lang/IllegalAccessException;
    :cond_26
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->setRecordStoreManager(Lorg/microemu/RecordStoreManager;)V

    goto/16 :goto_1

    .line 799
    .end local v7           #classLoader:Ljava/lang/ClassLoader;
    .restart local v4       #arg:Ljava/lang/String;
    .restart local v17       #tmpDevice:Ljava/lang/String;
    :catch_8
    move-exception v20

    goto/16 :goto_6
.end method

.method public loadImplementationsFromConfig()V
    .locals 6

    .prologue
    .line 721
    invoke-static {}, Lorg/microemu/app/Config;->getExtensions()Ljava/util/Map;

    move-result-object v1

    .line 722
    .local v1, extensions:Ljava/util/Map;
    invoke-interface {v1}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v3

    invoke-interface {v3}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    .local v2, iterator:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 723
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    .line 724
    .local v0, entry:Ljava/util/Map$Entry;
    invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/String;

    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Ljava/util/Map;

    const/4 v5, 0x0

    invoke-virtual {p0, v3, v4, v5}, Lorg/microemu/app/Common;->registerImplementation(Ljava/lang/String;Ljava/util/Map;Z)V

    goto :goto_0

    .line 726
    .end local v0           #entry:Ljava/util/Map$Entry;
    :cond_0
    return-void
.end method

.method protected loadJar(Ljava/lang/String;Ljava/lang/String;Lorg/microemu/app/classloader/MIDletClassLoader;)V
    .locals 17
    .parameter "jadUrl"
    .parameter "jarUrl"
    .parameter "midletClassLoader"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/ClassNotFoundException;
        }
    .end annotation

    .prologue
    .line 548
    if-nez p2, :cond_0

    .line 549
    new-instance v14, Ljava/lang/ClassNotFoundException;

    const-string v15, "Cannot find MIDlet-Jar-URL property in jad"

    invoke-direct {v14, v15}, Ljava/lang/ClassNotFoundException;-><init>(Ljava/lang/String;)V

    throw v14

    .line 551
    :cond_0
    const-string v14, "openJar"

    move-object v0, v14

    move-object/from16 v1, p2

    invoke-static {v0, v1}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V

    .line 554
    invoke-static {}, Lorg/microemu/app/Common;->dispose()V

    .line 556
    invoke-static {}, Lorg/microemu/MIDletBridge;->clear()V

    .line 558
    const/4 v14, 0x0

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    .line 560
    const/4 v11, 0x0

    .line 562
    .local v11, url:Ljava/net/URL;
    :try_start_0
    new-instance v12, Ljava/net/URL;

    move-object v0, v12

    move-object/from16 v1, p2

    invoke-direct {v0, v1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0

    .line 582
    .end local v11           #url:Ljava/net/URL;
    .local v12, url:Ljava/net/URL;
    :goto_0
    :try_start_1
    invoke-virtual {v12}, Ljava/net/URL;->getUserInfo()Ljava/lang/String;

    move-result-object v14

    if-eqz v14, :cond_4

    .line 583
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move-object/from16 v1, p2

    move v2, v14

    invoke-virtual {v0, v1, v2}, Lorg/microemu/app/Common;->saveJar2TmpFile(Ljava/lang/String;Z)Ljava/lang/String;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_2

    move-result-object v10

    .line 584
    .local v10, tmpURL:Ljava/lang/String;
    if-nez v10, :cond_2

    .line 630
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    move-object v11, v12

    .line 632
    .end local v12           #url:Ljava/net/URL;
    .end local v10           #tmpURL:Ljava/lang/String;
    .restart local v11       #url:Ljava/net/URL;
    :goto_1
    return-void

    .line 563
    :catch_0
    move-exception v14

    move-object v4, v14

    .line 564
    .local v4, ex:Ljava/net/MalformedURLException;
    if-eqz p1, :cond_1

    .line 566
    :try_start_2
    new-instance v12, Ljava/net/URL;

    new-instance v14, Ljava/lang/StringBuffer;

    invoke-direct {v14}, Ljava/lang/StringBuffer;-><init>()V

    const/4 v15, 0x0

    const/16 v16, 0x2f

    move-object/from16 v0, p1

    move/from16 v1, v16

    invoke-virtual {v0, v1}, Ljava/lang/String;->lastIndexOf(I)I

    move-result v16

    add-int/lit8 v16, v16, 0x1

    move-object/from16 v0, p1

    move v1, v15

    move/from16 v2, v16

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v14, v15}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v14

    move-object v0, v14

    move-object/from16 v1, p2

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v14

    invoke-virtual {v14}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v14

    invoke-direct {v12, v14}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0
    .catch Ljava/net/MalformedURLException; {:try_start_2 .. :try_end_2} :catch_4

    .line 568
    .restart local v12       #url:Ljava/net/URL;
    :try_start_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    .end local v11           #url:Ljava/net/URL;
    invoke-virtual {v12}, Ljava/net/URL;->toExternalForm()Ljava/lang/String;

    move-result-object v15

    invoke-virtual {v14, v15}, Lorg/microemu/util/JadProperties;->setCorrectedJarURL(Ljava/lang/String;)V

    .line 569
    const-string v14, "openJar url"

    invoke-static {v14, v12}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/Object;)V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_2
    .catch Ljava/net/MalformedURLException; {:try_start_3 .. :try_end_3} :catch_1

    goto :goto_0

    .line 570
    :catch_1
    move-exception v14

    move-object v5, v14

    move-object v11, v12

    .line 571
    .end local v12           #url:Ljava/net/URL;
    .restart local v11       #url:Ljava/net/URL;
    .local v5, ex1:Ljava/net/MalformedURLException;
    :goto_2
    :try_start_4
    const-string v14, "Unable to find jar url"

    invoke-static {v14, v5}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 572
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    .line 630
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    goto :goto_1

    .line 576
    .end local v5           #ex1:Ljava/net/MalformedURLException;
    :cond_1
    :try_start_5
    const-string v14, "Unable to find jar url"

    invoke-static {v14, v4}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 577
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    .line 630
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    goto :goto_1

    .line 588
    .end local v4           #ex:Ljava/net/MalformedURLException;
    .end local v11           #url:Ljava/net/URL;
    .restart local v10       #tmpURL:Ljava/lang/String;
    .restart local v12       #url:Ljava/net/URL;
    :cond_2
    :try_start_6
    new-instance v11, Ljava/net/URL;

    invoke-direct {v11, v10}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_2
    .catch Ljava/net/MalformedURLException; {:try_start_6 .. :try_end_6} :catch_2

    .line 593
    .end local v10           #tmpURL:Ljava/lang/String;
    .end local v12           #url:Ljava/net/URL;
    .restart local v11       #url:Ljava/net/URL;
    :goto_3
    :try_start_7
    move-object/from16 v0, p3

    move-object v1, v11

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoader;->addURL(Ljava/net/URL;)V

    .line 595
    invoke-static {}, Lorg/microemu/app/launcher/Launcher;->removeMIDletEntries()V

    .line 597
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14}, Lorg/microemu/util/JadProperties;->clear()V
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_0

    .line 598
    const/4 v6, 0x0

    .line 600
    .local v6, is:Ljava/io/InputStream;
    :try_start_8
    const-string v14, "META-INF/MANIFEST.MF"

    move-object/from16 v0, p3

    move-object v1, v14

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoader;->getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v6

    .line 601
    if-nez v6, :cond_5

    .line 602
    move-object/from16 v0, p0

    move-object v1, v11

    move-object/from16 v2, p3

    invoke-virtual {v0, v1, v2}, Lorg/microemu/app/Common;->describeJarProblem(Ljava/net/URL;Lorg/microemu/app/classloader/MIDletClassLoader;)Z

    move-result v14

    if-nez v14, :cond_3

    .line 603
    const-string v14, "Unable to find MANIFEST in MIDlet jar"

    invoke-static {v14}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;)V
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_1
    .catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_3

    .line 617
    :cond_3
    :try_start_9
    invoke-static {v6}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V
    :try_end_9
    .catchall {:try_start_9 .. :try_end_9} :catchall_0

    .line 630
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    goto/16 :goto_1

    .line 589
    .end local v11           #url:Ljava/net/URL;
    .end local v6           #is:Ljava/io/InputStream;
    .restart local v10       #tmpURL:Ljava/lang/String;
    .restart local v12       #url:Ljava/net/URL;
    :catch_2
    move-exception v14

    move-object v3, v14

    .line 590
    .local v3, e:Ljava/net/MalformedURLException;
    :try_start_a
    const-string v14, "Unable to open tmporary jar url"

    invoke-static {v14, v3}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_a
    .catchall {:try_start_a .. :try_end_a} :catchall_2

    .end local v10           #tmpURL:Ljava/lang/String;
    .end local v3           #e:Ljava/net/MalformedURLException;
    :cond_4
    move-object v11, v12

    .restart local v11       #url:Ljava/net/URL;
    goto :goto_3

    .line 607
    .end local v12           #url:Ljava/net/URL;
    .restart local v6       #is:Ljava/io/InputStream;
    :cond_5
    :try_start_b
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14, v6}, Lorg/microemu/util/JadProperties;->load(Ljava/io/InputStream;)V

    .line 609
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14}, Lorg/microemu/util/JadProperties;->keys()Ljava/util/Enumeration;

    move-result-object v3

    .local v3, e:Ljava/util/Enumeration;
    :goto_4
    invoke-interface {v3}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v14

    if-eqz v14, :cond_6

    .line 610
    invoke-interface {v3}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Ljava/lang/String;

    .line 611
    .local v8, key:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->manifest:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14, v8}, Lorg/microemu/util/JadProperties;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v13

    check-cast v13, Ljava/lang/String;

    .line 612
    .local v13, value:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14, v8, v13}, Lorg/microemu/util/JadProperties;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_b
    .catchall {:try_start_b .. :try_end_b} :catchall_1
    .catch Ljava/io/IOException; {:try_start_b .. :try_end_b} :catch_3

    goto :goto_4

    .line 614
    .end local v3           #e:Ljava/util/Enumeration;
    .end local v8           #key:Ljava/lang/String;
    .end local v13           #value:Ljava/lang/String;
    :catch_3
    move-exception v14

    move-object v3, v14

    .line 615
    .local v3, e:Ljava/io/IOException;
    :try_start_c
    const-string v14, "Unable to read MANIFEST"

    invoke-static {v14, v3}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_c
    .catchall {:try_start_c .. :try_end_c} :catchall_1

    .line 617
    :try_start_d
    invoke-static {v6}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .line 620
    .end local v3           #e:Ljava/io/IOException;
    :goto_5
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14}, Lorg/microemu/util/JadProperties;->getSuiteName()Ljava/lang/String;

    move-result-object v14

    invoke-static {v14}, Lorg/microemu/app/launcher/Launcher;->setSuiteName(Ljava/lang/String;)V

    .line 622
    move-object/from16 v0, p0

    iget-object v0, v0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    move-object v14, v0

    invoke-virtual {v14}, Lorg/microemu/util/JadProperties;->getMidletEntries()Ljava/util/Vector;

    move-result-object v14

    invoke-virtual {v14}, Ljava/util/Vector;->elements()Ljava/util/Enumeration;

    move-result-object v3

    .local v3, e:Ljava/util/Enumeration;
    :goto_6
    invoke-interface {v3}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v14

    if-eqz v14, :cond_7

    .line 623
    invoke-interface {v3}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lorg/microemu/util/JadMidletEntry;

    .line 624
    .local v7, jadEntry:Lorg/microemu/util/JadMidletEntry;
    invoke-virtual {v7}, Lorg/microemu/util/JadMidletEntry;->getClassName()Ljava/lang/String;

    move-result-object v14

    move-object/from16 v0, p3

    move-object v1, v14

    invoke-virtual {v0, v1}, Lorg/microemu/app/classloader/MIDletClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v9

    .line 625
    .local v9, midletClass:Ljava/lang/Class;
    new-instance v14, Lorg/microemu/MIDletEntry;

    invoke-virtual {v7}, Lorg/microemu/util/JadMidletEntry;->getName()Ljava/lang/String;

    move-result-object v15

    invoke-direct {v14, v15, v9}, Lorg/microemu/MIDletEntry;-><init>(Ljava/lang/String;Ljava/lang/Class;)V

    invoke-static {v14}, Lorg/microemu/app/launcher/Launcher;->addMIDletEntry(Lorg/microemu/MIDletEntry;)V
    :try_end_d
    .catchall {:try_start_d .. :try_end_d} :catchall_0

    goto :goto_6

    .line 630
    .end local v6           #is:Ljava/io/InputStream;
    .end local v3           #e:Ljava/util/Enumeration;
    .end local v7           #jadEntry:Lorg/microemu/util/JadMidletEntry;
    .end local v9           #midletClass:Ljava/lang/Class;
    :catchall_0
    move-exception v14

    :goto_7
    const/4 v15, 0x1

    move-object/from16 v0, p0

    move v1, v15

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    throw v14

    .line 617
    .restart local v3       #e:Ljava/util/Enumeration;
    .restart local v6       #is:Ljava/io/InputStream;
    :cond_6
    :try_start_e
    invoke-static {v6}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    goto :goto_5

    .end local v3           #e:Ljava/util/Enumeration;
    :catchall_1
    move-exception v14

    invoke-static {v6}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    throw v14

    .line 627
    .restart local v3       #e:Ljava/util/Enumeration;
    :cond_7
    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletContext()Lorg/microemu/MIDletContext;

    move-result-object v14

    move-object/from16 v0, p0

    move-object v1, v14

    invoke-virtual {v0, v1}, Lorg/microemu/app/Common;->startLauncher(Lorg/microemu/MIDletContext;)V

    .line 628
    const-string v14, ""

    invoke-static {v14}, Lorg/microemu/app/Common;->setStatusBar(Ljava/lang/String;)V
    :try_end_e
    .catchall {:try_start_e .. :try_end_e} :catchall_0

    .line 630
    const/4 v14, 0x1

    move-object/from16 v0, p0

    move v1, v14

    invoke-direct {v0, v1}, Lorg/microemu/app/Common;->setResponseInterface(Z)V

    goto/16 :goto_1

    .end local v11           #url:Ljava/net/URL;
    .end local v6           #is:Ljava/io/InputStream;
    .end local v3           #e:Ljava/util/Enumeration;
    .restart local v12       #url:Ljava/net/URL;
    :catchall_2
    move-exception v14

    move-object v11, v12

    .restart local v11       #url:Ljava/net/URL;
    goto :goto_7

    .line 570
    .end local v12           #url:Ljava/net/URL;
    .restart local v4       #ex:Ljava/net/MalformedURLException;
    :catch_4
    move-exception v14

    move-object v5, v14

    goto/16 :goto_2
.end method

.method public notifyDestroyed(Lorg/microemu/MIDletContext;)V
    .locals 1
    .parameter "midletContext"

    .prologue
    .line 177
    const-string v0, "notifyDestroyed"

    invoke-static {v0}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;)V

    .line 178
    invoke-virtual {p0}, Lorg/microemu/app/Common;->notifyImplementationMIDletDestroyed()V

    .line 179
    invoke-virtual {p0, p1}, Lorg/microemu/app/Common;->startLauncher(Lorg/microemu/MIDletContext;)V

    .line 180
    return-void
.end method

.method public notifyImplementationMIDletDestroyed()V
    .locals 3

    .prologue
    .line 736
    iget-object v2, p0, Lorg/microemu/app/Common;->extensions:Ljava/util/Vector;

    invoke-virtual {v2}, Ljava/util/Vector;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, iterator:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 737
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/microemu/microedition/ImplementationInitialization;

    .line 738
    .local v0, impl:Lorg/microemu/microedition/ImplementationInitialization;
    invoke-interface {v0}, Lorg/microemu/microedition/ImplementationInitialization;->notifyMIDletDestroyed()V

    goto :goto_0

    .line 740
    .end local v0           #impl:Lorg/microemu/microedition/ImplementationInitialization;
    :cond_0
    return-void
.end method

.method public notifyImplementationMIDletStart()V
    .locals 3

    .prologue
    .line 729
    iget-object v2, p0, Lorg/microemu/app/Common;->extensions:Ljava/util/Vector;

    invoke-virtual {v2}, Ljava/util/Vector;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, iterator:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 730
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/microemu/microedition/ImplementationInitialization;

    .line 731
    .local v0, impl:Lorg/microemu/microedition/ImplementationInitialization;
    invoke-interface {v0}, Lorg/microemu/microedition/ImplementationInitialization;->notifyMIDletStart()V

    goto :goto_0

    .line 733
    .end local v0           #impl:Lorg/microemu/microedition/ImplementationInitialization;
    :cond_0
    return-void
.end method

.method protected openMIDletUrl(Ljava/lang/String;)V
    .locals 1
    .parameter "urlString"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 243
    iput-object p1, p0, Lorg/microemu/app/Common;->midletClassOrUrl:Ljava/lang/String;

    .line 244
    iget-boolean v0, p0, Lorg/microemu/app/Common;->autoTests:Z

    if-nez v0, :cond_0

    .line 245
    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lorg/microemu/app/Common;->createMIDletClassLoader(Z)Lorg/microemu/app/classloader/MIDletClassLoader;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Lorg/microemu/app/Common;->openMIDletUrl(Ljava/lang/String;Lorg/microemu/app/classloader/MIDletClassLoader;)V

    .line 249
    :goto_0
    return-void

    .line 247
    :cond_0
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lorg/microemu/app/Common;->runAutoTests(Ljava/lang/String;Z)V

    goto :goto_0
.end method

.method public platformRequest(Ljava/lang/String;)Z
    .locals 1
    .parameter "URL"

    .prologue
    .line 481
    iget-object v0, p0, Lorg/microemu/app/Common;->emulatorContext:Lorg/microemu/EmulatorContext;

    invoke-interface {v0, p1}, Lorg/microemu/EmulatorContext;->platformRequest(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public registerImplementation(Ljava/lang/String;Ljava/util/Map;Z)V
    .locals 13
    .parameter "implClassName"
    .parameter "properties"
    .parameter "notFoundError"

    .prologue
    .line 660
    const-string v3, "Implementation initialization"

    .line 662
    .local v3, errorText:Ljava/lang/String;
    :try_start_0
    invoke-static {}, Lorg/microemu/app/Common;->getExtensionsClassLoader()Lorg/microemu/app/classloader/ExtensionsClassLoader;

    move-result-object v11

    invoke-virtual {v11, p1}, Lorg/microemu/app/classloader/ExtensionsClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v6

    .line 663
    .local v6, implClass:Ljava/lang/Class;
    sget-object v11, Lorg/microemu/app/Common;->class$org$microemu$microedition$ImplementationInitialization:Ljava/lang/Class;

    if-nez v11, :cond_2

    const-string v11, "org.microemu.microedition.ImplementationInitialization"

    invoke-static {v11}, Lorg/microemu/app/Common;->class$(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v11

    sput-object v11, Lorg/microemu/app/Common;->class$org$microemu$microedition$ImplementationInitialization:Ljava/lang/Class;

    :goto_0
    invoke-virtual {v11, v6}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z

    move-result v11

    if-eqz v11, :cond_4

    .line 664
    invoke-virtual {v6}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;

    move-result-object v7

    .line 665
    .local v7, inst:Ljava/lang/Object;
    new-instance v9, Ljava/util/HashMap;

    invoke-direct {v9}, Ljava/util/HashMap;-><init>()V

    .line 666
    .local v9, parameters:Ljava/util/Map;
    const-string v11, "emulatorID"

    invoke-static {}, Lorg/microemu/app/Config;->getEmulatorID()Ljava/lang/String;

    move-result-object v12

    invoke-interface {v9, v11, v12}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 667
    if-eqz p2, :cond_3

    .line 668
    invoke-interface {v9, p2}, Ljava/util/Map;->putAll(Ljava/util/Map;)V

    .line 676
    :cond_0
    :goto_1
    move-object v0, v7

    check-cast v0, Lorg/microemu/microedition/ImplementationInitialization;

    move-object v8, v0

    invoke-interface {v8, v9}, Lorg/microemu/microedition/ImplementationInitialization;->registerImplementation(Ljava/util/Map;)V

    .line 677
    const-string v11, "implementation registered"

    invoke-static {v11, p1}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V

    .line 678
    iget-object v11, p0, Lorg/microemu/app/Common;->extensions:Ljava/util/Vector;

    invoke-virtual {v11, v7}, Ljava/util/Vector;->add(Ljava/lang/Object;)Z

    .line 718
    .end local v6           #implClass:Ljava/lang/Class;
    .end local v7           #inst:Ljava/lang/Object;
    .end local v9           #parameters:Ljava/util/Map;
    :cond_1
    :goto_2
    return-void

    .line 663
    .restart local v6       #implClass:Ljava/lang/Class;
    :cond_2
    sget-object v11, Lorg/microemu/app/Common;->class$org$microemu$microedition$ImplementationInitialization:Ljava/lang/Class;

    goto :goto_0

    .line 670
    .restart local v7       #inst:Ljava/lang/Object;
    .restart local v9       #parameters:Ljava/util/Map;
    :cond_3
    invoke-static {}, Lorg/microemu/app/Config;->getExtensions()Ljava/util/Map;

    move-result-object v4

    .line 671
    .local v4, extensions:Ljava/util/Map;
    invoke-interface {v4, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Ljava/util/Map;

    .line 672
    .local v10, prop:Ljava/util/Map;
    if-eqz v10, :cond_0

    .line 673
    invoke-interface {v9, v10}, Ljava/util/Map;->putAll(Ljava/util/Map;)V
    :try_end_0
    .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_4

    goto :goto_1

    .line 707
    .end local v6           #implClass:Ljava/lang/Class;
    .end local v7           #inst:Ljava/lang/Object;
    .end local v9           #parameters:Ljava/util/Map;
    .end local v4           #extensions:Ljava/util/Map;
    .end local v10           #prop:Ljava/util/Map;
    :catch_0
    move-exception v11

    move-object v2, v11

    .line 708
    .local v2, e:Ljava/lang/ClassNotFoundException;
    if-eqz p3, :cond_7

    .line 709
    const-string v11, "Implementation initialization"

    invoke-static {v11, v2}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2

    .line 680
    .end local v2           #e:Ljava/lang/ClassNotFoundException;
    .restart local v6       #implClass:Ljava/lang/Class;
    :cond_4
    :try_start_1
    const-string v11, "initialize implementation"

    invoke-static {v11, p1}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/ClassNotFoundException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_1 .. :try_end_1} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_4

    .line 681
    const/4 v8, 0x1

    .line 684
    .local v8, isStatic:Z
    const/4 v11, 0x0

    :try_start_2
    invoke-virtual {v6, v11}, Ljava/lang/Class;->getConstructor([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;

    move-result-object v1

    .line 685
    .local v1, c:Ljava/lang/reflect/Constructor;
    invoke-virtual {v1}, Ljava/lang/reflect/Constructor;->getModifiers()I

    move-result v11

    invoke-static {v11}, Ljava/lang/reflect/Modifier;->isPublic(I)Z

    move-result v11

    if-eqz v11, :cond_5

    .line 686
    const/4 v8, 0x0

    .line 687
    invoke-virtual {v6}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;
    :try_end_2
    .catch Ljava/lang/NoSuchMethodException; {:try_start_2 .. :try_end_2} :catch_5
    .catch Ljava/lang/ClassNotFoundException; {:try_start_2 .. :try_end_2} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_2 .. :try_end_2} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_2 .. :try_end_2} :catch_4

    .line 692
    .end local v1           #c:Ljava/lang/reflect/Constructor;
    :cond_5
    :goto_3
    if-eqz v8, :cond_1

    .line 694
    :try_start_3
    const-string v11, "instance"

    const/4 v12, 0x0

    invoke-virtual {v6, v11, v12}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v5

    .line 695
    .local v5, getinst:Ljava/lang/reflect/Method;
    invoke-virtual {v5}, Ljava/lang/reflect/Method;->getModifiers()I

    move-result v11

    invoke-static {v11}, Ljava/lang/reflect/Modifier;->isStatic(I)Z

    move-result v11

    if-eqz v11, :cond_6

    .line 696
    const/4 v11, 0x0

    invoke-virtual {v5, v6, v11}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_3
    .catch Ljava/lang/NoSuchMethodException; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_3 .. :try_end_3} :catch_3
    .catch Ljava/lang/ClassNotFoundException; {:try_start_3 .. :try_end_3} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_3 .. :try_end_3} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_3 .. :try_end_3} :catch_4

    goto :goto_2

    .line 700
    .end local v5           #getinst:Ljava/lang/reflect/Method;
    :catch_1
    move-exception v11

    move-object v2, v11

    .line 701
    .local v2, e:Ljava/lang/NoSuchMethodException;
    :try_start_4
    const-string v11, "No known way to initialize implementation class"

    invoke-static {v11}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;)V
    :try_end_4
    .catch Ljava/lang/ClassNotFoundException; {:try_start_4 .. :try_end_4} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_4 .. :try_end_4} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_4 .. :try_end_4} :catch_4

    goto :goto_2

    .line 713
    .end local v6           #implClass:Ljava/lang/Class;
    .end local v8           #isStatic:Z
    .end local v2           #e:Ljava/lang/NoSuchMethodException;
    :catch_2
    move-exception v11

    move-object v2, v11

    .line 714
    .local v2, e:Ljava/lang/InstantiationException;
    const-string v11, "Implementation initialization"

    invoke-static {v11, v2}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2

    .line 698
    .end local v2           #e:Ljava/lang/InstantiationException;
    .restart local v5       #getinst:Ljava/lang/reflect/Method;
    .restart local v6       #implClass:Ljava/lang/Class;
    .restart local v8       #isStatic:Z
    :cond_6
    :try_start_5
    const-string v11, "No known way to initialize implementation class"

    invoke-static {v11}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;)V
    :try_end_5
    .catch Ljava/lang/NoSuchMethodException; {:try_start_5 .. :try_end_5} :catch_1
    .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_5 .. :try_end_5} :catch_3
    .catch Ljava/lang/ClassNotFoundException; {:try_start_5 .. :try_end_5} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_5 .. :try_end_5} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_5 .. :try_end_5} :catch_4

    goto :goto_2

    .line 702
    .end local v5           #getinst:Ljava/lang/reflect/Method;
    :catch_3
    move-exception v11

    move-object v2, v11

    .line 703
    .local v2, e:Ljava/lang/reflect/InvocationTargetException;
    :try_start_6
    const-string v11, "Unable to initialize Implementation"

    invoke-virtual {v2}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable;

    move-result-object v12

    invoke-static {v11, v12}, Lorg/microemu/log/Logger;->debug(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_6
    .catch Ljava/lang/ClassNotFoundException; {:try_start_6 .. :try_end_6} :catch_0
    .catch Ljava/lang/InstantiationException; {:try_start_6 .. :try_end_6} :catch_2
    .catch Ljava/lang/IllegalAccessException; {:try_start_6 .. :try_end_6} :catch_4

    goto :goto_2

    .line 715
    .end local v6           #implClass:Ljava/lang/Class;
    .end local v8           #isStatic:Z
    .end local v2           #e:Ljava/lang/reflect/InvocationTargetException;
    :catch_4
    move-exception v11

    move-object v2, v11

    .line 716
    .local v2, e:Ljava/lang/IllegalAccessException;
    const-string v11, "Implementation initialization"

    invoke-static {v11, v2}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_2

    .line 711
    .local v2, e:Ljava/lang/ClassNotFoundException;
    :cond_7
    new-instance v11, Ljava/lang/StringBuffer;

    invoke-direct {v11}, Ljava/lang/StringBuffer;-><init>()V

    const-string v12, "Implementation initialization "

    invoke-virtual {v11, v12}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v11

    invoke-virtual {v11, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v11}, Lorg/microemu/log/Logger;->warn(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 689
    .end local v2           #e:Ljava/lang/ClassNotFoundException;
    .restart local v6       #implClass:Ljava/lang/Class;
    .restart local v8       #isStatic:Z
    :catch_5
    move-exception v11

    goto :goto_3
.end method

.method protected saveJar2TmpFile(Ljava/lang/String;Z)Ljava/lang/String;
    .locals 11
    .parameter "jarUrl"
    .parameter "reportError"

    .prologue
    .line 331
    const/4 v2, 0x0

    .line 333
    .local v2, is:Ljava/io/InputStream;
    :try_start_0
    new-instance v6, Ljava/net/URL;

    iget-object v8, p0, Lorg/microemu/app/Common;->jad:Lorg/microemu/util/JadProperties;

    invoke-virtual {v8}, Lorg/microemu/util/JadProperties;->getJarURL()Ljava/lang/String;

    move-result-object v8

    invoke-direct {v6, v8}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 334
    .local v6, url:Ljava/net/URL;
    invoke-virtual {v6}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v0

    .line 335
    .local v0, conn:Ljava/net/URLConnection;
    invoke-virtual {v6}, Ljava/net/URL;->getUserInfo()Ljava/lang/String;

    move-result-object v8

    if-eqz v8, :cond_0

    .line 336
    new-instance v7, Ljava/lang/String;

    invoke-virtual {v6}, Ljava/net/URL;->getUserInfo()Ljava/lang/String;

    move-result-object v8

    const-string v9, "UTF-8"

    invoke-virtual {v8, v9}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v8

    invoke-static {v8}, Lorg/microemu/util/Base64Coder;->encode([B)[C

    move-result-object v8

    invoke-direct {v7, v8}, Ljava/lang/String;-><init>([C)V

    .line 337
    .local v7, userInfo:Ljava/lang/String;
    const-string v8, "Authorization"

    new-instance v9, Ljava/lang/StringBuffer;

    invoke-direct {v9}, Ljava/lang/StringBuffer;-><init>()V

    const-string v10, "Basic "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9, v7}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v0, v8, v9}, Ljava/net/URLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    .line 339
    .end local v7           #userInfo:Ljava/lang/String;
    :cond_0
    invoke-virtual {v0}, Ljava/net/URLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v2

    .line 340
    const/4 v5, 0x0

    .line 341
    .local v5, tmpDir:Ljava/io/File;
    const-string v8, "java.io.tmpdir"

    invoke-static {v8}, Lorg/microemu/app/util/MIDletSystemProperties;->getSystemProperty(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 342
    .local v3, systemTmpDir:Ljava/lang/String;
    if-eqz v3, :cond_1

    .line 343
    new-instance v5, Ljava/io/File;

    .end local v5           #tmpDir:Ljava/io/File;
    const-string v8, "microemulator-apps"

    invoke-direct {v5, v3, v8}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 344
    .restart local v5       #tmpDir:Ljava/io/File;
    invoke-virtual {v5}, Ljava/io/File;->exists()Z

    move-result v8

    if-nez v8, :cond_1

    invoke-virtual {v5}, Ljava/io/File;->mkdirs()Z

    move-result v8

    if-nez v8, :cond_1

    .line 345
    const/4 v5, 0x0

    .line 348
    :cond_1
    const-string v8, "me2-app-"

    const-string v9, ".jar"

    invoke-static {v8, v9, v5}, Ljava/io/File;->createTempFile(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;

    move-result-object v4

    .line 349
    .local v4, tmp:Ljava/io/File;
    invoke-virtual {v4}, Ljava/io/File;->deleteOnExit()V

    .line 350
    invoke-static {v2, v4}, Lorg/microemu/app/util/IOUtils;->copyToFile(Ljava/io/InputStream;Ljava/io/File;)V

    .line 351
    invoke-static {v4}, Lorg/microemu/app/util/IOUtils;->getCanonicalFileClassLoaderURL(Ljava/io/File;)Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v8

    .line 358
    invoke-static {v2}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    .end local v6           #url:Ljava/net/URL;
    .end local v0           #conn:Ljava/net/URLConnection;
    .end local v3           #systemTmpDir:Ljava/lang/String;
    .end local v5           #tmpDir:Ljava/io/File;
    .end local v4           #tmp:Ljava/io/File;
    :goto_0
    return-object v8

    .line 352
    :catch_0
    move-exception v8

    move-object v1, v8

    .line 353
    .local v1, e:Ljava/io/IOException;
    if-eqz p2, :cond_2

    .line 354
    :try_start_1
    new-instance v8, Ljava/lang/StringBuffer;

    invoke-direct {v8}, Ljava/lang/StringBuffer;-><init>()V

    const-string v9, "Unable to open jar "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    invoke-virtual {v8, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8, v1}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 356
    :cond_2
    const/4 v8, 0x0

    .line 358
    invoke-static {v2}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    goto :goto_0

    .end local v1           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v8

    invoke-static {v2}, Lorg/microemu/app/util/IOUtils;->closeQuietly(Ljava/io/InputStream;)V

    throw v8
.end method

.method public setDevice(Lorg/microemu/device/Device;)V
    .locals 0
    .parameter "device"

    .prologue
    .line 639
    invoke-static {p1}, Lorg/microemu/app/util/MIDletSystemProperties;->setDevice(Lorg/microemu/device/Device;)V

    .line 640
    invoke-static {p1}, Lorg/microemu/device/DeviceFactory;->setDevice(Lorg/microemu/device/Device;)V

    .line 641
    return-void
.end method

.method public setRecordStoreManager(Lorg/microemu/RecordStoreManager;)V
    .locals 0
    .parameter "manager"

    .prologue
    .line 148
    iput-object p1, p0, Lorg/microemu/app/Common;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    .line 149
    return-void
.end method

.method public setResponseInterfaceListener(Lorg/microemu/app/ui/ResponseInterfaceListener;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 485
    iput-object p1, p0, Lorg/microemu/app/Common;->responseInterfaceListener:Lorg/microemu/app/ui/ResponseInterfaceListener;

    .line 486
    return-void
.end method

.method public setStatusBarListener(Lorg/microemu/app/ui/StatusBarListener;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 473
    sput-object p1, Lorg/microemu/app/Common;->statusBarListener:Lorg/microemu/app/ui/StatusBarListener;

    .line 474
    return-void
.end method

.method protected startLauncher(Lorg/microemu/MIDletContext;)V
    .locals 5
    .parameter "midletContext"

    .prologue
    const/4 v4, 0x0

    .line 442
    if-eqz p1, :cond_0

    invoke-virtual {p1}, Lorg/microemu/MIDletContext;->isLauncher()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 470
    :goto_0
    return-void

    .line 445
    :cond_0
    if-eqz p1, :cond_2

    .line 447
    :try_start_0
    invoke-virtual {p1}, Lorg/microemu/MIDletContext;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v1

    .line 448
    .local v1, previousMidletAccess:Lorg/microemu/MIDletAccess;
    if-eqz v1, :cond_1

    .line 449
    const/4 v2, 0x1

    invoke-virtual {v1, v2}, Lorg/microemu/MIDletAccess;->destroyApp(Z)V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    .line 455
    .end local v1           #previousMidletAccess:Lorg/microemu/MIDletAccess;
    :cond_1
    :goto_1
    iget-boolean v2, p0, Lorg/microemu/app/Common;->exitOnMIDletDestroy:Z

    if-eqz v2, :cond_2

    .line 456
    const/4 v2, 0x0

    invoke-static {v2}, Ljava/lang/System;->exit(I)V

    .line 461
    :cond_2
    :try_start_1
    new-instance v2, Lorg/microemu/app/launcher/Launcher;

    invoke-direct {v2, p0}, Lorg/microemu/app/launcher/Launcher;-><init>(Lorg/microemu/app/CommonInterface;)V

    sput-object v2, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    .line 462
    sget-object v2, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    invoke-static {v2}, Lorg/microemu/MIDletBridge;->getMIDletAccess(Ljavax/microedition/midlet/MIDlet;)Lorg/microemu/MIDletAccess;

    move-result-object v2

    invoke-virtual {v2}, Lorg/microemu/MIDletAccess;->startApp()V

    .line 463
    sget-object v2, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    sget-object v3, Lorg/microemu/app/Common;->launcher:Lorg/microemu/app/launcher/Launcher;

    invoke-virtual {v2, v3}, Lorg/microemu/app/launcher/Launcher;->setCurrentMIDlet(Ljavax/microedition/midlet/MIDlet;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_1

    .line 468
    invoke-static {v4}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    goto :goto_0

    .line 451
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 452
    .local v0, e:Ljava/lang/Throwable;
    const-string v2, "destroyApp error"

    invoke-static {v2, v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1

    .line 464
    .end local v0           #e:Ljava/lang/Throwable;
    :catch_1
    move-exception v2

    move-object v0, v2

    .line 465
    .restart local v0       #e:Ljava/lang/Throwable;
    :try_start_2
    new-instance v2, Ljava/lang/StringBuffer;

    invoke-direct {v2}, Ljava/lang/StringBuffer;-><init>()V

    const-string v3, "Unable to start launcher MIDlet, "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v2

    invoke-static {v0}, Lorg/microemu/app/ui/Message;->getCauseMessage(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2, v0}, Lorg/microemu/app/ui/Message;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 466
    invoke-virtual {p0, v0}, Lorg/microemu/app/Common;->handleStartMidletException(Ljava/lang/Throwable;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 468
    invoke-static {v4}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    goto :goto_0

    .end local v0           #e:Ljava/lang/Throwable;
    :catchall_0
    move-exception v2

    invoke-static {v4}, Lorg/microemu/MIDletBridge;->setThreadMIDletContext(Lorg/microemu/MIDletContext;)V

    throw v2
.end method
